The mechanism that accelerates particles to the energies required to produce the observed high-energy impulsive emission in solar flares is not well understood. Drake et al. (2006) proposed a mechanism for accelerating electrons in contracting magnetic islands formed by kinetic reconnection in multi-layered current sheets. We apply these ideas to sunward-moving flux ropes (2.5D magnetic islands) formed during fast reconnection in a simulated eruptive flare. A simple analytic model is used to calculate the energy gain of particles orbiting the field lines of the contracting magnetic islands in our ultrahigh-resolution 2.5D numerical simulation. We find that the estimated energy gains in a single island range up to a factor of five. This is higher than that found by Drake et al. for islands in the terrestrial magnetosphere and at the heliopause, due to strong plasma compression that occurs at the flare current sheet. In order to increase their energy by two orders of magnitude and plausibly account for the observed high-energy flare emission, the electrons must visit multiple contracting islands. This mechanism should produce sporadic emission because island formation is intermittent. Moreover, a large number of particles could be accelerated in each magnetohydrodynamic-scale island, which may explain the inferred rates of energetic-electron production in flares. We conclude that island contraction in the flare current sheet is a promising candidate for electron acceleration in solar eruptions.