NOVELTY - The method of producing biogas from dregs comprises directing a flow of organic material having nitrogen and/or phosphorus to a mixing stage, mixing the flow with water, sending the mixture to a digestion tank, controlling the temperature of the digestion tank by temperature control circuit unit, taking off biogas from the tank, removing digested material from the tank, removing water, phosphorus and ammonium to produce a product, and recycling all/a portion of the water, phosphorus and ammonium to the mixing stage and/or to another upstream process.    USE - Useful for producing biogas from dregs with a high content of nitrogen and/or phosphorus.    ADVANTAGE - The method produces 35-40 MW of biogas in factory, converts large proportion of the carbon contained in the dregs into biogas, returns nitrogen and phosphorus to agriculture, and produces very small quantities of waste water and a great reduction in water consumption for a large scale bioethanol factory.    DETAILED DESCRIPTION - The method of producing biogas from dregs comprises directing a flow of organic material having nitrogen and/or phosphorus to a mixing stage, mixing the flow with water, sending the mixture to a digestion tank, controlling the temperature of the digestion tank by temperature control circuit unit, taking off biogas from the tank, removing digested material from the tank, removing water, phosphorus and ammonium to produce a product rich in ammonium and/or phosphate and removing dehydrated solids, and recycling all/a portion of the water, phosphorus and ammonium to the mixing stage and/or to another upstream process. The temperature control circuit has pump and heat exchanger. The product rich in ammonium and/or phosphates is produced from ammonium nitrate and ammonium sulfate/ magnesium ammonium sulfate. A portion of the dehydrated solids is recycled to the mixing stage as a stream and/or removed as stream, and mixed with the stream rich in ammonium and/or phosphates to make a fertilizer/soil improvement compound/used as biofuel.    DESCRIPTION OF DRAWING(S) - The diagram shows a method of producing biogas:    Organic material; (1)    Mixing stage; (2)    Dilution water; (3)    Control system; (4)    Digestion tank. (5)