The invention relates to a method of treating feces in breeding industry, in particular relates to a method and a device for treating livestock feces in a breeding house underground to produce biogas and an organic fertilizer and belongs to the technology and equipment needed by resource and environment field. The device comprises a breeding house, a breeding house equipment room, a breeding house aisle, a feces gutter, a feces output pipe, a precipitation and impurity removal system, a solid-liquid separation system, a biogas digester system, a biogas temperature improvement and insulation system, a biogas reflux house flushing and crust breaking system and a biogas storage and purification system, wherein the breeding house, the breeding house equipment room, the breeding house aisle, the feces gutter, the feces output pipe, the precipitation and impurity removal system, the solid-liquid separation system, the biogas digester system, the biogas temperature improvement and insulation system, the biogas reflux house flushing and crust breaking system and the biogas storage and purification system are connected with one another. According to the method disclosed by the invention, the main treatment equipment is mounted in the breeding house underground, is small in occupied area, high in resource comprehensive utilization ratio and remarkable in economical and environmentally friendly benefits and is capable of purifying the biogas and producing the organic fertilizer.