Based on the frequency-shaping optimal control method, this paper proposes a time-domain robust disturbance rejection design approach for a class of uncertain flexible mechanical systems subject to persistent disturbances and time-varying parameter perturbations. In the approach, a frequency-shaping output filter is first employed to combine with the mechanical system and a Kalman filter to form an augmented system. Some eigenvalues of the frequency-shaping output filter coincide with the unstable poles of the disturbance dynamics to perform disturbance rejection. Then, for the designed closed-loop system to have asymptotic stability, a new robust stability condition is proposed. It is shown that, using the proposed stability condition, the resulting controller can suppress the persistent disturbance and keep the flexible mechanical system from the possibility of instability caused by spillover and time-varying parameter perturbations. Finally, two examples are given to demonstrate the use of the design approach.