3D resonant magnetic perturbation (RMP) is one promising way to control edge localized modes that can cause excessive material erosion of tokamak first walls. However, RMP can lead to undesired degradation of plasma confinement, including fast-particle losses, which can impact the performance and safety of the reactor. This work investigates the optimization of the poloidal spectrum of the 3D field to optimize fast ion confinement during ELM suppression. In the initial step, the validity of the modeling framework is tested against experimental data. Simulations successfully replicate an increase in poloidal limiter temperature with different poloidal spectra. Then, the simulation shows improvement of fast ion confinement with a reduction of core resonant response, while edge resonant magnetic fields are maintained above the threshold to sustain the ELM suppression. Reduction of the core resonant fields keeps the Kolmogorov–Arnold–Moser (KAM) surface and reduces the fast particle losses due to the stochastic magnetic field lines. The results highlight the potential of edge localization of the resonant fields to enhance the performance of fusion reactors, but further investigation is needed to improve the validation of this approach.