The rising frequency and severity of droughts due to global climate change have posed significant challenges to agriculture, particularly in the Ta-pieh Mountains of China, where the economy relies heavily on agriculture. Accurate drought prediction and understanding mechanisms are essential for reducing drought-related losses. This study proposes a framework that integrates machine learning with explainable artificial intelligence (XAI) to predict and analyze agricultural droughts in the Ta-pieh Mountains. The framework employs four machine learning models: Extreme Gradient Boosting (XGBoost), Random Forest (RF), Long Short-Term Memory (LSTM) networks, and Backpropagation Neural Networks (BPNN). The models were trained on data from 2000 to 2021, with 2022 serving as an independent case study to evaluate their prediction accuracy. Results indicate that XGBoost and RF models demonstrated high accuracy across all metrics, significantly outperforming the LSTM and BPNN models. Additionally, the framework integrates Shapley Additive Explanations (SHAP) with RF and XGBoost models to analyze the contributions of various driving factors in agricultural drought events. For example, in the autumn drought of 2019, meteorological features contributed 75.53 %, while soil, topographic, and socio-economic factors contributed 8.86 %, 8.59 %, and 7.03 %, respectively. The analysis examined interactions between key factors and spatial patterns, showing how their contributions varied with drought severity and location. This offers detailed insights into the roles of different factors in drought prediction. In conclusion, this framework has potential for near real-time drought dynamics through data updates and can be applied to similar regions, aiding local decision-makers in effective water resource management strategies.