his study aimed to explain the crop yield prediction system as a way to address the challenges posed by global warming and climate change in Saudi Arabia, while also taking into account socio-economic factors. Machine learning models were trained using crop yield prediction data to provide recommendations for future crop production. Climate change poses significant challenges, with rising temperatures and extreme weather events being increasingly evident. Agriculture, contributing 14% of greenhouse gas emissions, plays a crucial role in exacerbating this issue. This study introduced a crop yield prediction system leveraging machine learning models trained on comprehensive datasets. Recommendations derived from these models offer insights into optimal crop rotation strategies, particularly relevant for regions like the Kingdom of Saudi Arabia. Collaboration between farmers and governments, informed by data-driven approaches, is crucial in this endeavor. Utilizing a customized dataset, this study analyzed a machine learning model performance and identified optimal hyperparameters. XGBoost ensemble emerged as the top performer with an R2 score of 0.9745, showcasing its potential to advance crop yield prediction capabilities. By integrating machine learning into agricultural decision-making processes, stakeholders aim to enhance crop production and soil health and contribute to climate change mitigation efforts. This collaborative effort represents a significant step toward sustainable agriculture and climate resilience in Saudi Arabia.