In this research, for the first time, CuO and CdO nanoparticles (NPs) were synthesized and anchored on layered bentonite using Ferula persica in the interest of developing a novel S-scheme nano-heterojunction (denoted as CuO-CdO-BT). Ferula persica acted as a naturally-sourced reducing agent and stabilizer for the synthesis of NPs. The performance of CuO-CdO-BT was evaluated for the degradation of levofloxacin from aqueous solution under sunlight. The bentonite as a support not only reduced the agglomeration of CuO and CdO NPs, but also decreased the size of biosynthesized NPs, which in turn increased the active surface of NPs and the photodegardation efficiency. The effect of operational reaction system variables was examined in an attempt to optimize the photocatalytic capability of CuO-CdO-BT. Under optimum conditions (catalyst dosage = 0.4 g/L, LVF concentration = 10 mg/L and pH = 8), 96.11% of levofloxacin was degraded using CuO-CdO-BT after 30 min with degradation kinetic of 0.108 min− 1, which was about 2.4 and 4.2 times higher than those of bare CuO and CdO NPs, respectively. The prominent role of superoxide radicals (\({\text{O}}_{2}^{\bullet -})\) and hydroxyl radicals (·OH) was determined in the photocatalytic reaction by the radical quenching experiments. The possible levofloxacin pathways were suggested based on the HPLC-MS analysis. High stability was demonstrated for biosynthesized photocatalyst during recycling experiments and 88.56% degradation efficiency was obtained after three cycles of photodegradation. The unique structural features of the new generation of S-scheme heterojunction and green synthesis of NPs using plant provide promising photocatalysts with synergistic features to improve wastewater treatment.