Pati Regency is one of Indonesia's major salt-producing regions, where production remains highly dependent on rainfall conditions. The wet dry-season phenomenon has increased uncertainty in production schedules, highlighting the need for accurate rainfall forecasting. This study aims to identify the most influential features, compare the performance of XGBoost models with and without hyperparameter optimization using the Whale Optimization Algorithm (WOA), and forecast ten-day rainfall in Pati Regency for the next six periods. The research began with feature engineering on historical ten-day rainfall data, followed by feature selection using Recursive Feature Elimination with Cross-Validation (RFECV). The selected features were used to develop both the baseline XGBoost model and the WOA-optimized XGBoost model. Model performance was evaluated using the Root Mean Square Error (RMSE). The optimal feature subset consisted of 12 features: lag 1, lag 2, lag 3, lag 5, lag 6, rolling mean 3, rolling mean 6, rolling standard deviation 6, rolling mean 9, rolling mean 18, rolling standard deviation 18, and the dasarian sine feature. The optimized XGBoost-WOA model achieved a lower RMSE (44.37) than the baseline XGBoost model (50.12). Forecasted rainfall for the next six ten-day periods was 12.65, 32.77, 33.23, 42.66, 48.25, and 48.25 mm per ten-day period, indicating that dry-season conditions remain favorable for salt production despite increasing rainfall toward the end of the forecast horizon. Therefore, XGBoost-WOA provides a promising alternative for ten-day rainfall forecasting to support salt production planning in Pati Regency.