In order to improve efficiency and energy utilization rate of coal mine microgrid system, optimal configuration model of coal mine microgrid capacity for power generation with coalbed methane was established taking comprehensive net benefit of coal mine as objective function, and taking cost, generated income and various constraints of coal mine microgrid into consideration. According to power generation of wind turbine generator and photovoltaic battery and load data of the whole year, particle swarm optimization algorithm is used to solve the capacity optimization configuration model, and installation capacity of distributed power and energy storage equipment are obtained. The optimal configuration scheme is obtained through example simulation, and cost and benefit analysis show that the power exchange process between microgrid and large grid generates generate revenue. At the same time, the effects of different operating indicators such as renewable energy ratio and spontaneous use rate on the configuration results were analyzed, and the research results can provide reference for equipment capacity planning of coal mine microgrid.