The potential energy increase with the displacement from equilibrium position of the spring. The potential energy is maximum at maximum displacement from equilibrium position.
Potential energy at a displacement, x, is given by,
V=kx2/2,
Where k is spring constant and depends on the properties of the spring