This study assesses the efficacy of particle swarm optimization (PSO) in estimating scale ( c) and shape ( k) parameters of the Weibull distribution model for wind energy forecasting at two key wind farm sites in Morocco— Tarfaya in the south and Tangier in the north, utilizing real wind data from 2022. Employing a novel square frequency error objective function to enhance parameter accuracy, the study adopts a two-stage training approach involving recursive least-square estimation and PSO fine-tuning. Validation with artificial data underscores PSO’s effectiveness under diverse wind conditions. Parameter sensitivity analysis identifies four optimal PSO configurations, with the PSO-4 model exhibiting superior performance. Comparative analysis against traditional and heuristic optimization methods consistently demonstrates PSO-4’s lowest root-mean-square error (RMSE) and mean absolute error (MAE), high coefficients of determination ( R2), and shortest computation time. The research highlights PSO-4 model as a precise and efficient tool for Weibull distribution parameter estimation in wind energy forecasting, showcasing robust convergence across both wind farm sites.