Accurate short-term electrical load forecasting is crucial for the stable operation of power systems. Given the nonlinear, periodic, and rapidly changing characteristics of short-term power load forecasts, this paper introduces a novel forecasting method employing an Extreme Learning Machine (ELM) enhanced by an improved Dwarf Mongoose Optimization Algorithm (Local escape Dwarf Mongoose Optimization Algorithm, LDMOA). This method addresses the significant prediction errors of conventional ELM models and enhances prediction accuracy. The enhancements to the Dwarf Mongoose Optimization Algorithm include three key modifications: initially, a dynamic backward learning strategy is integrated at the early stages of the algorithm to augment its global search capabilities. Subsequently, a cosine algorithm is employed to locate new food sources, thereby expanding the search scope and avoiding local optima. Lastly, a “madness factor” is added when identifying new sleeping burrows to further widen the search area and effectively circumvent local optima. Comparative analyses using benchmark functions demonstrate the improved algorithm’s superior convergence and stability. In this study, the LDMOA algorithm optimizes the weights and thresholds of the ELM to establish the LDMOA-ELM prediction model. Experimental forecasts utilizing data from China’s 2016 “The Electrician Mathematical Contest in Modeling” demonstrate that the LDMOA-ELM model significantly outperforms the original ELM model in terms of prediction error and accuracy.