The generator is designed to mix water with a foaming agent, generate an inert foam by injecting nitrogen gas or liquid into the foaming mixture and supplying it through boreholes and underground pipelines to the areas of spontaneous combustion for the purposes pf their prevention, localization and suppression.