The optimal configuration of energy storage system capacity is one of the effective measures to reduce the cost of Microgrid. A method for optimizing the capacity allocation of wind, photovoltaic and hydrogen energy storage hybrid systems considering the whole life cycle economic optimization was established. Firstly, this paper establishes various benefit and cost models, and establishes a hybrid system capacity allocation model considering the charging and discharging power constraints of the energy storage system (ESS). Secondly, the ESS control strategy is designed based on the capacity allocation model, including the judgment of ESS action timing and the selection of electrolyzer operation mode, ensuring a high degree of matching between the control strategy and capacity allocation. Finally, the particle swarm algorithm is used to solve the capacity optimization configuration model of the energy storage hybrid system, and the optimal configuration of the system is obtained. In the calculation example, the impact on capacity allocation under different control strategies is analyzed, and the optimal configuration scheme of the system is obtained. The results of the calculation example show that using the capacity allocation method proposed in this paper, when the wind resources are determined and the parameters remain unchanged, there is an approximately linear relationship between the wind turbine power, configuration results and the total system revenue. At the same time, it provides a reference for the optimal configuration of microgrid energy storage capacity.