Nitrogen (N) and phosphorus (P) are primary pollutants contributing to water quality degradation and eutrophication but are also indispensable resources for agricultural production. In this study, we synthesized porous MgO/Mg(OH)2-modified starch gels (SC-M/SC-OM) to facilitate the simultaneous removal of N and P from wastewater and address the challenges associated with separating and recycling powdered materials. By immobilizing magnesium powder within the matrix of starch gel, with the addition of 1.7 % w/w of MgO and 2.4 % w/w of Mg(OH)₂, the adsorbent can be efficiently recovered from the liquid phase, minimizing material loss. Due to their inherent pH-regulating capabilities, the modified starch gels exhibited excellent removal performance over a wide pH range. At the appropriate adsorbent dose, the maximum recovery of SC-M was 70.072 mg/g P and 25.517 mg/g N, whereas SC-OM was marginally inferior to SC-M. The pseudo-first kinetic model more accurately represented the adsorption of the two materials, showing that N and P concentrations mainly affected the adsorption efficiency, which benefits nutrient recovery at higher concentrations. Starch gels function as carriers for powdered magnesium and contribute to the synergistic removal of N and P, particularly enhancing P removal. SC-OM primarily facilitates the recovery of N and P by forming struvite. At the same time, the adsorption during the hydration process of MgO also plays a crucial role in the recovery with SC-M. Finally, the pot experiment confirmed the feasibility of using the recovered SC as a sustained release fertilizer. This study reveals the significant potential of SC-M/SC-OM for environmentally friendly nutrient removal and recovery, providing a promising approach for wastewater treatment and nutrient recycling.