Abstract Antibiotics as emerging pollutants have attracted extensive attention due to their ecotoxicity and persistence in the environment. Adsorption of antibiotics on carbon-based materials (CBMs) such as biochar and activated carbon was recognized as one of the most promising technologies for wastewater treatment. This study applied machine learning (ML) methods to develop generic prediction models of tetracycline (TC) and sulfamethoxazole (SMX) adsorption on CBMs. The results suggested that random forest outperformed gradient boosting trees and artificial neural network for both TC and SMX adsorption models. The random forest models could accurately predict the adsorption capacity of antibiotics on CBMs using material properties and adsorption conditions as model inputs. The developed ML models presented better generalization ability than traditional isotherm models under variable environmental conditions (e.g., temperature, solution pH) and adsorbent types. The relative importance analysis and partial dependence plots based on ML models were performed to compare TC and SMX adsorption on CBMs. The results indicated the critical role of specific surface area for both TC (24%) and SMX (45%) adsorption, while the other material properties (e.g., H/C, (O + N)/C, pHpzc) showed variable influences due to the differences in molecular structures, functional groups, and pKa values of TC and SMX. The accurate ML prediction models with generalization ability are useful for designing efficient CBMs with minimal experimental screening, while the relative importance and partial dependence plot analysis can guide rational applications of CBMs for antibiotics wastewater treatment.