In Latin America, a deficit in wastewater treatment translates into the degradation of the environmental quality of other ecological spaces. Due to this problem, the effect of the use of a biofilter on the treatment of domestic wastewater was investigated. In this research was evaluated the parameters of turbidity, dissolved oxygen, COD, BOD5, total solids, dissolved solids, and total suspended solids and mainly the parameter of oils and fats (determined by the Soxhlet method). The water sample was obtained from the peri-urban area of San Benito at the Carabayllo district. The treatment unit used two residual inputs: biochar that was made from shell residues of Carya illinoinensis and hydrogel that was made with Caesalpinia spinosa gum; previously were determined the physical-chemical parameters of these inputs. The following configuration was used in the treatment unit: an 80 L tank to deposit domestic wastewater, the biofilter made up of 3 beds of biochar (+/- 12 mesh) of 700 g, 800 g, and 700 g respectively, a flocculation tank of 20 L to which was added the Caesalpinia spinosa gel, another biofilter with 2 beds of 600 g and 700 g respectively and, finally, a tank to receive the treated water. The process carried out during the implementation of the test was characterized by being continuous: On every 30 minutes was adding 500 ml of hydrogel for 5 times and at the same process, the treated water samples were collected in an amount of 2 L every 25 minutes. On a removal process of 3 hours and 20 minutes, the final results showed a reduction of oils and fats from an initial value of 906 mg/l to 277 mg/l (69.43% reduction); Additionally, other physicochemical parameters were also reduced, obtained a final values of 80.70 NTU of turbidity, 2.53 mg/l of dissolved oxygen, 548.3 mg/l of COD, 4.17 BOD5, 1,211 mg/l of total solids, 948 mg/l of dissolved solids and 233 mg /l of total suspended solids. This research proves the positive effect of this biofilter for the removal of oils and fats, so it can be considered an alternative solution in wastewater sanitation problems.