The discrete-time robust disturbance attenuation problem for the n-degrees of freedom (dof) mechanical systems with uncertain energy function is considered in this paper. First, it is shown in the continuous time-setting that the robust control problem of n-dof mechanical systems can be reduced to a disturbance attenuation problem when a specific type of control rule is used. Afterwards, the robust disturbance attenuation problem is formulised as a special disturbance attenuation problem. Then, the discrete-time counterpart of this problem characterised by means of L-2 gain is given. Finally, a solution of the problem via direct-discrete-time design is presented as a sufficient condition. The proposed discrete-time design utilizes discrete gradient of the energy function of considered system. Therefore, a new method is also proposed using the quadratic approximation lemma to construct discrete gradients for general energy functions. The proposed direct-discrete-time design method is used to solve the robust disturbance attenuation problem for the double pendulum system. Simulation results are given for the discrete gradient obtained with the method presented in this paper. Note that the solution presented here for the robust disturbance attenuation problem give an explicit algebraic condition on the design parameter, whereas solution of the same problem requires solving a Hamilton-Jacobi-Isaacs partial differential inequality in general nonlinear systems.