In wastewater treatment, energy consumption and effluent quality are conflicting objectives. Improving effluent quality while reducing energy consumption has become a pressing issue. This paper proposes a dynamic optimal control method for the wastewater treatment process, utilizing neural networks and multi-objective dragonfly algorithm. A regression prediction model, based on a Self-Attention mechanism of a multi-scale convolutional neural network-bidirectional gated recurrent unit, is used to establish a soft measurement model for effluent quality and energy consumption, serving as the optimization objective function. The multi-objective dragonfly algorithm then optimizes this objective to determine the optimal set values for control variables. A Linear Active Disturbance Rejection Control, based on a scalable bandwidth linear extended state observer, is designed to track these optimal set values. The proposed method is tested using Benchmark Simulation Model No. 1 (BSM1). Results demonstrate that the method effectively obtains and tracks optimal set values of control variables, ensuring effluent quality meets standards and significantly reducing energy consumption compared to four other methods.