NOVELTY - The method for the production and purification of biogas, comprises producing biogas from biomass and purifying the biogas by a separating stage (2), which feeds the biogas in the form of crude gas stream and separates the crude gas stream into methane stream and weak gas stream, which is transferred in a block-type thermal power station (4) in heat and electric stream. A variable portion of the crude gas stream is brought directly to the thermal power station by a bypass line bypassing the separating stage. A membrane is used for separating the crude gas stream in the separating stage.    USE - Method for the production and purification of biogas.    ADVANTAGE - The method ensures efficient, rapid and simple production and purification of biogas with high quality and quantity, low investment costs and less consumption of energy.    DETAILED DESCRIPTION - The method for the production and purification of biogas, comprises producing biogas from biomass and purifying the biogas by a separating stage (2), which feeds the biogas in the form of crude gas stream and separates the crude gas stream into methane stream and weak gas stream, which is transferred in a block-type thermal power station (4) in heat and electric stream. A variable portion of the crude gas stream is brought directly to the thermal power station by a bypass line bypassing the separating stage. A membrane is used for separating the crude gas stream in the separating stage and is adjusted in such a way that the weak gas stream has a portion of 25 vol.% and/or 30 vol.% of methane. The biogas is completely purified by a single step. A micro gas turbine or ignition jet motor is used in the thermal power station. Heat produced in the thermal power station is used for producing the biogas. Stream provided in the power station is used for condensing the biogas stream so that natural gas is fed into the stream, and/or for carrying out the biogas production. A part of the stream provided in the power station is fed into a stream network. An INDEPENDENT CLAIM is included for a device for the production and purification of biogas.    DESCRIPTION OF DRAWING(S) - The figure shows a device for the production and purification of biogas.    Separating stage (2)    Block-type thermal power station (4)    Crude gas line (5)    Compressor (7)    Weak gas line (8)    Heat exchanger circuit. (9)