This paper proposes a novel multi-level optimization method for the management of port energy system with high penetration of renewable energy under the dual-carbon background, to support the main power grid while supplying power to local loads. A cost optimization model for the port energy system is established, and the corresponding constraint conditions are provided. A three-stage energy management optimization method is proposed by combining rule-based algorithm with firefly algorithm. Based on real-time grid price and battery energy level, the optimal charging and discharging decisions for the energy storage system are formulated. Secondly, a dynamic pricing scheme is proposed to encourage both parties (ports and ships) to adopt alternative marine power (AMP) technology. For performance evaluation, the proposed method will be applied to a port system connected to a 2 MW AMP load. The results show that the proposed method can effectively schedule energy equipment and save about 20% or more of the cost of the system, verifying the effectiveness of the proposed method.