NOVELTY - The method comprises: providing a wastewater stream in a pretreatment tank that produces excess sludge, biogas, and a pretreated stream; flowing the pretreated stream and return activated sludge (14) to an anoxic tank (16) operating under anoxic conditions; mixing the pretreated stream and the return activated sludge in the anoxic tank to form a mixed liquor; transferring the mixed liquor to an aerated tank (18); and transferring the mixed liquor to a membrane tank (20) that separates treated effluent from activated sludge containing microorganisms.    USE - The method is useful for treating wastewater to simultaneously remove organic matter, nitrogen, and phosphorus with energy recovery (claimed), where the wastewater comprises food industry wastewater.    ADVANTAGE - The method is capable of simultaneously removing nitrogen, phosphorus, and organic matter from plant influent wastewater in an energy and cost efficient manner with very low amounts of dissolved oxygen and carbon.    DETAILED DESCRIPTION - The method comprises: providing a wastewater stream in a pretreatment tank that produces excess sludge, biogas, and a pretreated stream, where the biogas comprises methane and carbon dioxide; flowing the pretreated stream and return activated sludge (14) to an anoxic tank (16) operating under anoxic conditions; mixing the pretreated stream and the return activated sludge in the anoxic tank to form a mixed liquor; transferring the mixed liquor to an aerated tank (18) operating under microaerophilic conditions, to simultaneously effectuate nitrification, denitrification, phosphorus release, and phosphorus uptake in the aerated tank; and transferring the mixed liquor to a membrane tank (20) that separates treated effluent from activated sludge containing microorganisms, where a first portion of the activated sludge is returned to the anoxic tank as the return activated sludge. The wastewater stream is plant influent wastewater (12) that is to be treated by carbon removal. The biogas comprises about 60% of the methane. The pretreatment tank is an upflow anaerobic sludge blanket (UASB) reactor. The biogas is treated such that it can be used to power a wastewater treatment plant that treats the plant influent wastewater by offsetting energy requirements of the wastewater treatment plant. The microaerophilic conditions in the aerated tank promote fermentation of the particulate organic matter in the mixed liquor and allow for development of a microbial population used for phosphorus removal. A portion of the wastewater stream bypasses the pretreatment tank and is directed to the anoxic tank. The pretreatment tank utilizes chemically enhanced primary treatment (CEPT) and a one-stage activated sludge system. An INDEPENDENT CLAIM is included for a system for treating wastewater to simultaneously remove organic matter, nitrogen, and phosphorus with energy recovery.    DESCRIPTION OF DRAWING(S) - The figure shows a flow diagram of a wastewater treatment process.    Plant influent wastewater (12)    Activated sludge (14)    Anoxic tank (16)    Aerated tank (18)    Membrane tank. (20)