Extensive exposure to antibiotics could potentially be harmful to the environment and human health. The development of effective and convenient technologies to remove residual antibiotics from water is imperative. Herein, we successfully developed a facile method via pyrolysis of Fe-MIL-88B_NH2 to synthesize magnetic nanocomposites (MNC) as potential adsorbents, which exhibited cluster-shape structure and excellent magnetic response. Magnetic nanocomposites carbonized at 700 °C showed high efficiency for sulfamethoxazole (SMX) adsorption (73.53 mg/g). Some experimental conditions including solution pH, ionic strength, coexisting ions and SMX concentration were systematically investigated. The adsorption isotherm and kinetic followed Langmuir and the pseudo-second-order models, and the adsorption process was dependent on the solution pH. The adsorption mechanism hypothesis was pore filling effect, π–π EDA and electrostatic interactions. Moreover, MNC-700 exhibited good reusability and magnetic separation properties, being reused six times without significant loss in adsorption capacity. © 2020 Elsevier Inc.