Ammonia has great prospects in the context of the transition to carbon-free energy. It can be used as fuel in gas turbines, fuel cells, internal combustion engines, and burned together with coal. However, industrial production of ammonia is based on the Haber-Bosh process, which involves the use of natural gas and coal, which, in this case, does not make it really carbon-free. This study proposes a method to produce ammonia, which is environmentally friendly and does not require the use of fossil fuels. It is based on the approach to adjusting the concentration of ammonium nitrogen in a biogas reactor and implies the sorption of ammonia from the gas phase with a solution of monoammonium phosphate, obtaining diammonium phosphate, and subsequently heating it with the release of ammonia. The factors influencing the extraction of ammonia from waste have been considered, as well as the influence of temperature on the release of ammonia from the solution of diammonium phosphate; the energy efficiency of the method has been assessed. With increasing temperature, the degree of ammonia and the degree of sorbent regeneration increased. Under laboratory conditions, 111 J/g of ammonia energy was spent. The higher the concentration of (NH4)2HPO4 in the solution, the less energy is required to obtain a unit of ammonia mass. The total amount of ammonia released varies depending on the temperature. Sorbent regeneration can be carried out using thermal energy obtained at a cogeneration plant. The possibility of using this method to produce ammonia at an industrial scale has been estimated by analyzing the ways of ammonia utilization as a fuel. The potential for ammonia production in the main livestock industries in Europe and the United States is up to 11,482,651.15 and 11,582,169.5 tons per year, respectively. Applying this solution also makes it possible to improve the efficiency of biogas production from waste with high nitrogen content. The proposed method of ammonia production could potentially contribute to the development of carbon-free energy