The invention discloses polyurethane foam gum with expandable graphite and diatomite to cooperatively enhance flame retarding, which is prepared from, by weight, 150-160 parts of diphenyl methane diisocyanate, 100-105 parts of trihydroxy polyoxypropylene ether, 100-110 parts of castor oil, 5-6 parts of glycerol, 40-43 parts of diethyl phosphate, a proper amount of a 1 mol / L sodium hydroxide solution, 13-15 parts of diatomite, 5-6 parts of distilled water, 2-3 parts of triethanol amine, 3-4 parts of dibutyltin dilaurate, 3-4 parts of lauryl sodium sulfate, 5-6 parts of silicon oil, 3-4 parts of the expandable graphite, a proper amount of anhydrous ethanol, 0.8-1 part of cetyl trimethyl ammonium bromide, and a proper amount of deionized water. The foam gum is used for sealing switch cabinets and machine cabinets, is high in strength and is wear-resistant, can achieve on-site foaming and reduce production cost, has high total sealing performance, has simple and easy-to-control production process, and is safe and environment-friendly.