Hint: Use the ampere-circuital law.
Step 1: Consider a magnetic field line of B through the bar magnet as given in the figure below.
The magnetic field line of B through the bar magnet must be a closed-loop.
Let C be the amperian loop. Then,
∫PQH⋅dl=∫PQBm0dl
We know that the angle between B and dl is less than 90° inside the bar magnet. So, it is positive.
i.e. ∫PQH⋅dl=∫PQBμ0⋅dl>0
Hence, the lines of B must run from the south pole (S) to the north pole (N) inside the bar magnet.
Step 2: According to Ampere's law,
∴ ∮PQPH.dl=0
∴ ∮PQPH.dl = ∮QPH.dl + ∮PQH.dl = 0
As, ∫QPH⋅dl > 0, and, ∫PQH⋅dl < 0 (i.e., negative)
It will be so if the angle between H and dl is more than 90°, so that cosθ is negative. It means the line of H must run from N-pole to S-pole inside the bar magnet.