Pests significantly impact agricultural productivity, making early detection crucial for maximizing yields. This paper explores the use of machine learning models to predict olive fly and red spider mite infestations in Andalusia. Four datasets on crop phenology, pest populations, and damage levels were used, with models developed using the Python package H2O, which focuses on interpretability through SHAP values and ICE plots. The results showed high precision in predicting pest outbreaks, particularly for the olive fly, with minimal differences between models using feature selection. In the vineyard dataset, the selection of characteristics improved the performance of the model by reducing the MAE and increasing R2. Explainability techniques identified solar radiation and wind direction as key factors in olive fly predictions, while past pest occurrences and wind velocity were influential for red spider mites, providing farmers with actionable insights for timely pest control.