This study aimed to forecast dam inflows and subsequently predict its capability in producing HEPP using machine learning and evolutionary optimization techniques. Mahabad Dam, located in the northwest of Iran and recognized as one of the nation’s key dams, served as a case study. First, artificial neural networks (ANN) and support vector regression (SVR) were employed to predict dam inflows, with optimization of parameters achieved through Harris hawks optimization (HHO), a robust optimization technique. The data of temperature, precipitation, and dam inflow over a 24-year period on a monthly basis, incorporating various lag times, were used to train these machines. Then, HEPP from the dam was predicted using temperature, precipitation, dam inflow, and dam evaporation as input variables. The models were applied to data covering the years 2000 to 2020. The results of the first part indicated both hybrid models (HHO-ANFIS and HHO-SVR) improved the prediction performance compared to the single models. Based on the results of Taylor’s diagram and the error evaluation criteria, the HHO-ANFIS hybrid model (RMSE, MAE, and NSE of 3.90, 2.41, and 0.86, respectively) exerted better performance than HHO-SVR (RMSE, MAE, and NSE of 4.39, 2.70, and 0.86, respectively). The results of the second part showed that using the HHO algorithm to optimize single models (RMSE, MAE, and NSE of 0.2, 10, and 0.90, respectively) predicted HEPP better than single models (RMSE, MAE, and NSE of 0.2, 10, and 0.90, respectively). The results of Taylor’s diagram also showed that the HHO-ANFIS model exerted better performance. The findings of this study indicated the promising performance of machine learning models optimized by metaheuristic algorithms in the simultaneous prediction of dam inflows and HEPP in multi-purpose dams for better management and allocation of surface water resources.