The high proportion of renewable energy access makes the economic dispatch of microgrid face the dual challenges of bilateral source load uncertainty and high dimensional nonlinear constraints. The traditional particle swarm optimization algorithm tends to converge prematurely, and its convergence accuracy is insufficient when solving this problem. In this paper, an improved particle swarm optimization (PSO) algorithm is proposed, which integrates a nonlinear adaptive inertia weight, a learning factor dynamic cooperative strategy, and a mutation disturbance mechanism based on population diversity monitoring. The algorithm adjusted the population fitness variance feedback inertia weight, establishes an exploration development stage criterion based on the evolutionary rate to realize asymmetric cooperation of learning factors, and uses the fitness variance as a premature judgment index to trigger Gaussian mutation disturbance. A typical grid connected microgrid including photovoltaic, wind power, diesel generator, and energy storage is taken as an example to verify under three scenarios: typical day, high fluctuation day and extreme weather day. The results show that the optimal operating cost of the improved algorithm is 1,983.5 yuan in typical daily scenarios, which is 6.95% lower than that of the standard PSO algorithm. The standard deviation across ten independent runs is 9.8 yuan, which is 56.6% lower than that of the standard algorithm. The source load bilateral strategy coordination reduces the cost by 8.03%, demonstrating a positive interaction effect. The cost in the extreme weather scenario is 2,851.9 yuan, which is still significantly lower than the comparison algorithm. This study provides an efficient and robust optimization solution for economic dispatch in microgrids under high uncertainty.