The invention discloses a wind farm energy storage capacity optimization method in consideration of optimal desired output and charge state. The method comprises the steps as follows: firstly, a computing method of an optimal desired output is proposed and utilizes a function with minimum square deviation of offset of a grid-connected power target value as an objective function, setting subjectivity of a stabilizing fluctuation output power target value is eliminated, and the computing method serves as the premise of energy storage capacity optimization; secondly, an energy storage SOC (state of charge) parameter is introduced, charge-discharge power is timely adjusted on the basis of the fuzzy control theory, SOC and charge-discharge states, an energy storage charge-discharge strategy is built, and excessive charge and discharge are effectively restrained; and finally, an optimal model is built with minimum sum of the penalty cost associated with the SOC and the operation cost, so that the energy storage capacity optimization integrating a schedule decision-making requirements, energy storage operating service life and economic efficiency is achieved, and related optimizing problems are solved with improved PSO (particle swarm optimization). The solution algorithm provided by the method is fast, efficient, and strong in convergence capacity.