Three successive treatments were applied to modify the orange peel (OP) residues using NaOH, sodium dodecyl sulfate (SDS), and Fe3O4 nanoparticles for the removal of basic blue 9 (BB9). The structure and morphology of the chemically modified adsorbents were investigated using various analytical techniques including PXRD, FTIR, FESEM/EDAX, VSM, and N2 physisorption analyses. The removal of BB9 by modified adsorbents was modeled using two machine learning (mL) approaches. A gradient boosting regression tree (GBRT) model for 8 adsorbents and extreme gradient boosting (XGBoost) model for optimal adsorbent were designed based on 584 and 73 sets of experimental data, respectively. The scikit-learn library was used to determine the importance of each feature for building the GBRT and XGBoost models and it was confirmed that all the parameters affect the BB9 removal process to a remarkable extend. The adsorption isotherm data were fitted to Langmuir, Freundlich, and Temkin models. The kinetics and thermodynamics investigations showed that the removal of BB9 follows a pseudo-second-order kinetic model that is spontaneous and exothermic. The BB9 desorption experiments in water and HCl showed that the electrostatic interaction has a significant role in the removal of BB9 on chemically modified orange peel residues. The adsorption mechanism studies using Boyd’s theory indicated that the adsorption of BB9 on the modified adsorbents was mainly governed by the external mass transport where the particle diffusion was the rate limiting step.