In view of the feed/foods inevitably contaminated by toxic and carcinogenic aflatoxin B1 (AFB1), efficient mesoporous metformin-chitosan/silica‑cobalt ferrite nanospheres (Mt-CS/CFS NSs) was prepared to remove AFB1 from aqueous/non-aqueous media. The morphological, functional, and structural characteristics and adsorption properties of C/N-enriched CS/CFS were investigated systematically. The interactive operating variables (temperature (5.0–35 °C); time (10–100 min); AFB1 dose (50–100 μg/mL); and Mt-CS/CFS dosage (0.5–3.5 mg) were optimized via the Box-Behnken design (BBD), which demonstrated good agreement between the experimental data and proposed model. The adsorption efficiency in artificially contaminated cow's milk as well as aqueous environment reached over 91.0 % in a wide pH range (3.0–9.0), without significant change in the nutritional value of milk. Freundlich isotherm and second-order adsorption kinetics were regarded as the most suitable models to fit the adsorption results, and the adsorption rate is dominated by the intra-particle diffusion and boundary layer diffusion. Thermodynamic analyses proved that the process was spontaneous and exothermic. The adsorption mechanism could be explained as physisorption via hydrogen bonding, n-π interaction, and hydrophobic/hydrophilic interactions. The porous Mt-CS/CFS NS derived from chitosan nanoparticles is therefore outstanding adsorbent, offering great adsorptive performance and recycabilities, which impedes economic losses in the food industry.