Distributed energy systems with the characteristics of flexible scheduling, high reliability, and high efficiency have been widely studied because it can absorb abundant renewable energy and solve long‐distance energy transmission loss. Wind power, photovoltaic power, and user load power have obvious intermittently and volatility, which brings difficulties to the dispatching and control of distributed energy systems. This work focuses on the optimal control problem of a distributed energy system considering multiple disturbance inputs. A discrete system model suitable for developing optimal control is established and solved by minimizing performance function in the process of iterating disturbance inputs and its function vector. Based on the optimal control results, a method for stabilizing the output power is designed to consider operating cost and loss. The effectiveness of the proposed method is verified by different disturbance inputs and compared with the classical optimization algorithm. The results indicate that the optimal control model can effectively suppress disturbance influences and obtain a fast and satisfactory control effect. The output stabilization method can save operating costs and reduce equipment loss. Compared with the optimization algorithm, the proposed method is more stable and reliable. This work provides a new insight into multi‐disturbance suppression of the distributed energy systems.