The large-scale integration of distributed generation brings challenges such as operation instability and large fluctuation of distribution network margin to the new distribution network. A reasonable distributed generation configuration scheme can reduce the power supply cost and improve the energy utilization rate of the distribution system. This paper establishes a two-layer optimization model based on the economy, environmental protection and power supply reliability of distributed microgrid. The capacity of distributed microgrid is configured in the upper layer, and the economy of distributed microgrid is optimized in the lower layer. Under the constraints of the installation number, power balance and battery state of charge of distributed generation, adopt an improved multi-objective particle swarm optimization algorithm to solve the problem. The algorithm improves the learning factor and inertia weight to ensure the global search ability of the algorithm in the early stage and the fast convergence to the optimal solution in the later stage, and introduces an adaptive mutation crossover strategy in the particle search process to avoid the particle falling into local optimum. The experimental results indicate the improved MOPSO algorithm obtains lower comprehensive cost, more reasonable configuration capacity, faster convergence speed and stronger optimization ability in the simulation process, which verifies the feasibility of the algorithm.