Agricultural wastes are various types of residual materials generated in the process of agricultural production, such as crop stalks, fruit shells, etc., which are so large in quantity that they not only cause waste of resources but also may lead to many problems, such as environmental pollution, if they are not handled properly. This study focuses on the sustainable utilization of agricultural waste - peanut shells, especially the modification of peanut shell biomass charcoal and its application in dye wastewater treatment, aiming to achieve the removal of Congo red dye from wastewater in an eco-friendly manner. The study evaluated the effect of Fe3O4-PEI-BC on CR adsorption by varying the reaction temperature, reaction time, adsorbent dosage, pH, and initial dye concentration. The experimental results showed that the adsorption efficiency was higher as the temperature was increased to 35 °C, the reaction time was prolonged, the concentration of adsorbent was more than 40 mg/150 mg CR/L, the pH value was 2, and the initial concentration of CR was 50 mg/L. This study not only provides a new idea for the resource utilization of agricultural waste but also provides an effective technical solution for the environmental protection treatment of printing and dyeing wastewater.