In this study, we propose a fully discrete energy stable scheme for the phase-field moving contact line model with variable densities and viscosities. The mathematical model comprises a Cahn–Hilliard equation, Navier–Stokes equation, and the generalized Navier boundary condition for the moving contact line. A scalar auxiliary variable is employed to transform the governing system into an equivalent form, thereby allowing the double well potential to be treated semi-explicitly. A stabilization term is added to balance the explicit nonlinear term originating from the surface energy at the fluid–solid interface. A pressure stabilization method is used to decouple the velocity and pressure computations. Some subtle implicit–explicit treatments are employed to deal with convention and stress terms. We establish a rigorous proof of the energy stability for the proposed time-marching scheme. A finite difference method based on staggered grids is then used to spatially discretize the constructed time-marching scheme. We also prove that the fully discrete scheme satisfies the discrete energy dissipation law. Our numerical results demonstrate the accuracy and energy stability of the proposed scheme. Using our numerical scheme, we analyze the contact line dynamics based on a shear flow-driven droplet sliding case. Three-dimensional droplet spreading is also investigated based on a chemically patterned surface. Our numerical simulation accurately predicts the expected energy evolution and it successfully reproduces the expected phenomena where an oil droplet contracts inward on a hydrophobic zone and then spreads outward rapidly on a hydrophilic zone.