The use of chitosan-based flocculants (CBFs) to remove dissolved heavy metals from wastewater is widely advocated. This study applied machine learning (ML) methods to develop a prediction model for the efficiency of heavy metals removal using CBFs. The random forest (RF) models could accurately predict the removal efficiency of heavy metals (R2 = 0.9354, RMSE = 5.67) according to flocculant properties, flocculation conditions, and heavy metal properties. The solution pH (pHsol) in flocculation conditions and the molecular weight (Mv) in flocculant properties were identified as the most dominant parameters in flocculation performance with feature importance weights of 0.294 and 0.134, respectively. The partial dependence analysis showed the impact way of each influential factor and their combined effects on the heavy metal removal efficiency using CBFs. Overall, a prediction model was successfully developed for the efficiency of heavy metals removal, which will guide rational applications of CBFs for the treatment of wastewater containing heavy metals.