Predicting leaf mineral composition is critical for monitoring plant health and optimizing agricultural practices. This study combines Fourier-transform infrared spectroscopy with attenuated total reflectance (FTIR-ATR) and machine learning (ML) to specific macronutrients, namely nitrogen (N), phosphorus (P), potassium (K), calcium (Ca), and magnesium (Mg), in fig leaves (Ficus carica L.). A dataset of 90 leaves was analyzed, with FTIR spectra (450–4000 cm⁻1) preprocessed via baseline correction and second-derivative transformations. Three ML models were evaluated using fivefold cross-validation including Random Forest (RF), Support Vector Regression (SVR), and Gradient Boosting (GB), with performance assessed via root mean square error (RMSE), coefficient of determination (R2), and ratio of performance to deviation (RPD). GB outperformed other models, achieving validation RMSE/RPD values of 0.133/1.60 (nitrogen, N), 0.0107/1.79 (phosphorus, P), 0.1328/1.65 (potassium, K), 0.0636/1.96 (magnesium, Mg), and 0.2657/1.60 (calcium, Ca). Predictions for Mg (validation R2 = 0.7351) and P (validation R2 = 0.6873) exhibited the highest accuracy, potentially attributed to their stronger or more distinct spectral features (e.g., Mg-O stretching around 1050– 1150 cm⁻1; P-O vibrations around 1240 cm⁻1). Cross-validation revealed robust generalization for GB; while mean training RMSE was very low (< 0.01 for P and Mg), validation RMSE remained relatively low, underscoring the model’s utility for screening (RPD > 1.5). Despite evidence of overfitting (training R2 ≈ 0.999 vs. validation R2 = 0.61–0.74), GB’s performance evaluated using both RMSE and RPD confirmed its superiority over RF and SVR, which showed higher errors (e.g., SVR for Ca: RMSE = 0.4574, RPD = 1.07). This study demonstrates that FTIR-ATR coupled with ML is a rapid, non-destructive alternative to conventional destructive chemical analysis and that GB’s reliability, as indicated by RPD values > 1.5, offers actionable insights for precision nutrient management in sustainable agriculture.