Under the “carbon peaking and carbon neutrality” strategy, the penetration ratio of renewable energy is increasing, while the lack of flexible resources becomes a growing challenge. To address this and build a safe, efficient, low-carbon, and clean energy system, an integrated energy system (IES) optimization allocation method is proposed considering the joint operation of multiple flexibility resources. First, the modeling of the two stages of the power-to-gas equipment is refined, with the introducation of the coordinated operation of the hydrogen-doped gas turbine and the power-to-gas equipment to make full use of the low-carbon characteristics of H2. Carbon raw materials are provided for the power-to-gas facilities through carbon capture equipment realizing the recycling of CO2, thereby establishing a coordinated operation framework for flexible resource with hydrogen energy as the core. Then, aimed at the uncertainty of renewable energy output, the optimal clustering number is determined by Elbow method, and typical wind speed scenarios are obtained by K-means clustering algorithm. On this basis, an optimal allocation model is established with the objective of minimizing the sum of investment cost, operation and maintenance cost, replacement cost, environmental penalty, and wind abandonment penalty cost, taking into account equipment constraints, energy balance constraints, and flexibility constraints. To solve the nonlinearity, the large M method is adopted to linearize the model and complete the model solution. Finally, the method proposed is validated through an example based on measured data from a region in southwest China. The results show that the total cost of the IES is reduced by 10.22%, the penetration rate of new energy is increased by 6.01%, and the cost of environmental penalties is reduced by 2.65%. The proposed method effectively improves the economy of the system and the consumption of new energy, and significantly reduces system carbon emissions.