F = Gm1m2/r^2 ---------> 1
Dimensions :
F = [MLT^-2]
G = [M^-1 L^3 T^-2]
m1 = [M]
m2 = [M]
r^2 = [L^2]
Substituting the values in equation 1
[MLT^-2] = [M^-1L^3T^-2] x [M] x [M] / [L^2]
[MLT^-2] = [M]^-1+2 x [L]^3-2 x [T]^-2
[MLT^-2] = [M]^1 x [L]^1 x [T]^-2
[MLT^-2] = [MLT^-2]
L.H.S = R.H.S
Therefore Newton's law of gravitation is dimensionally correct.