We know that the torque acting on a magnetic dipole.
But, is the normal on the plane of the loop and is directed in the direction of advancement of a right handed screw, if we rotate the screw in the sense of current in the loop.
On passing a current through the coil, this torque acting on the magnetic dipole, is counterbalanced by the moment of additional weight, about O. Hence, the direction of current in the loop must be in the direction, shown in the figure.