The loss of soil available nutrients may affect soil quality and crop growth. Biochar can form a multi-level fixed network because of its rich pore structure and surface functional groups, which can effectively fix available nutrients in soil and maintain nutrient utilization rate. Because it is difficult to directly prepare biochar materials with good adsorption characteristics through experimental results. This study employed an XGBoost machine learning prediction model to determine the optimal nutrient-rich biochar preparation conditions. The R2 value ranged from 0.97 to 0.99. The results indicated that specific surface area was the primary factor influencing ammonium nitrogen adsorption, with a feature importance of 56.13%. Production conditions (hydrothermal temperature and time) significantly affected the adsorption of nitrate nitrogen and available phosphorus, with feature importances of 75.91% and 81.54%, respectively. Mean pore diameter was negatively correlated with potassium ion adsorption characteristics. Biochar prepared under hydrothermal conditions at 202.50–251.25 °C for 3 h exhibited favorable adsorption characteristics for multiple soil available nutrients. This study provides new insights into biochar’s application in the field of soil nutrient adsorption through data analysis. It is helpful to avoid the waste in the process of energy utilization from biomass to biochar.