Accurate assessment of crop yield is necessary for the use of resources in agroclimatic zones. This study emphasizes the need for an optimized approach for yield prediction utilizing the XGBoost machine learning algorithm using Indian agricultural datasets from the Kaggle library. The phases of data pre-processing, feature engineering, Bayesian hyperparameter optimization, and explanation analysis using SHAP make up the optimization approach. Performance measures like RMSE, MAE, and R2 have been