We investigate the finite-time thermodynamics of a single-level fermion system interacting with a particle reservoir. The optimal protocol to extract the maximum work from the system when moving the single energy level between an initial higher value and a final lower value in a finite time is calculated from a quantum master equation. The calculation also yields the optimal protocol to raise the energy level with the expenditure of the least amount of work on the system. The optimal protocol displays discontinuous jumps at the initial and final times. Copyright © 2010 EPLA.