The invention discloses a device and method for preparing nitrogen foam cement. The preparing device comprises a foam cement producer, a liquid nitrogen evaporator, a liquid nitrogen plunger pump, a foam liquid plunger pump, a foam liquid tank, a heat exchange system, a liquid nitrogen pipeline, a high-pressure cement paste pipeline, a first pipeline, a foam cement discharge pipeline and a densitydetecting device. The heat generated by a power unit, a hydraulic system and other devices in a nitrogen foam well fixing device is recovered through the heat exchange system, the recovered heat is used as a heat source of the liquid nitrogen evaporator, energy conservation and environment protection are realized, the energy utilization rate is high, and equipment input is low. Liquid nitrogen and foam liquid are pressurized through a high-pressure liquid nitrogen plunger pump and a high-pressure foam liquid plunger pump, the mixing uniformity is increased, and the density of foam cement is reduced. The density of the foam cement is detected in real time through the density detecting device, the flow of the liquid nitrogen and/or foam liquid is adjusted according to the density, and the density is simply controlled. By arranging a clear water tank, after operation ends, the equipment and pipelines are flushed, and the service life is polonged.