Introduction: Olive oil's biochemical quality, particularly its content of phenolics, flavonoids, antioxidants, and carotenoids, depends on a complex interplay between irrigation, nitrogen fertilization, and growing season, making reliable prediction from agronomic data alone unreliable. Fourier-transform infrared spectroscopy (ATR-FTIR), paired with machine learning, offers a faster alternative to wet-chemistry analysis, yet no calibration model has so far been validated across multiple seasons and agronomic treatments for Moroccan olive cultivars.
Methods: A 3 × 3 factorial trial was conducted on 'Moroccan Picholine' (Olea europaea L.) trees, combining three irrigation levels with three NPK fertilization rates over two growing seasons (2022/2023 and 2023/2024), yielding 324 cold-pressed oil samples. Total phenolic content, total flavonoid content, DPPH radical scavenging activity, and carotenoid content were measured by wet-chemistry assays and served as reference values. ATR-FTIR spectra were preprocessed using four strategies and modeled with Random Forest and XGBoost regression, validated through 5-fold cross-validation and an independent 20% blind test set.
Results: Principal component analysis separated samples mainly by irrigation level and growing season, with specific infrared regions associated with C–O stretching vibrations contributing strongly to this variance. First-derivative spectra gave the most accurate predictions overall, with test-set R² values ranging from 0.925 to 0.943 and RPD values between 3.66 and 4.20 across the four parameters. Feature-importance analysis pointed to a small set of spectral regions, alongside growing season, as the main drivers behind these predictions, lending biochemical interpretability to the models.
Conclusions: Combining mid-infrared spectroscopy with ensemble machine learning enables accurate, simultaneous prediction of four key quality parameters in olive oil across different seasons and agronomic conditions. This approach provides a practical, reagent-free tool for monitoring olive oil quality at scale, with direct relevance to precision agriculture in Moroccan olive production systems.