Optimal energy management of electric vehicles using slap swarm optimization and differential flatness control has been proposed. A battery–supercapacitor power system is adopted. Each source is connected in parallel to the DC-bus using DC–DC bidirectional converters and supplies a synchronous reluctance motor (SynRM) based drive. The proposed EMS fundamental forces lie in using a combination of complementary proprieties of two approaches, a Slap Swarm optimization Algorithm and Differential Flatness (DF). With a fast optimization mechanism, the Slap Swarm optimization algorithm allows adapting in real-time conditions the DF gains to optimize the system performances. On its side, DF uses predefined trajectories respecting the physical proprieties of the system, which is a powerful tool to guarantee the dynamic constraints of the sources when ensuring desired robust control proprieties. To check the feasibility and performance of the suggested EMS, comprehensive processor-in-the-loop co-simulations of the electric vehicle were carried out using the C2000 launchxl-f28379d DSP board. The main goal of the proposed EMS is to guarantee the DC-bus stabilization, reducing the DC-bus voltage ripples (Δv = 5 V) and the voltage overshoots 15 V (3.2%), respect the source dynamics, and satisfy the SynRM motor power demand. Furthermore, the algorithm minimizes induced harmonics by the drive (10.49%), reducing the battery current ripple by 17.15A, thereby enhancing the battery lifecycle.