A numerical study of magnetohydrodynamics (MHD) and tracer-particle evolution investigates the effects of resonant magnetic perturbations (RMPs) on the confinement of runaway electrons (REs) in tokamak discharges conducted in the Madison Symmetric Torus. In computational results of applying RMPs having a broad toroidal spectrum but a single poloidal harmonic, m = 1 RMP does not suppress REs, whereas m = 3 RMP achieves significant deconfinement but not the complete suppression obtained in the experiment [Munaretto et al., Nuclear Fusion 60, 046024 (2020)]. MHD simulations with the NIMROD code produce sawtooth oscillations, and the associated magnetic reconnection can affect the trajectory of REs starting in the core region. Simulations with m = 3 RMP produce chaotic magnetic topology over the outer region, but the m = 1 RMP produces negligible changes in field topology, relative to applying no RMP. Using snapshots of the MHD simulation fields, full-orbit relativistic electron test particle computations with KORC show ≈50% loss from the m = 3 RMP compared to the 10%–15% loss from the m = 1 RMP. Test particle computations of the m = 3 RMP in the time-evolving MHD simulation fields show correlation between MHD activity and late-time particle losses, but total electron confinement is similar to computations using magnetic-field snapshots.