Joule is a unit of work.
Now by using the formula of work done
W = F s(F = force and s = displacement)
= Mas (a = acceleration)
= Msv/t (v = velocity and t = time)
=Ms s/t2 (as velocity is displacement /time)
W = M s2/t2
hence the above formula is in form of its fundamental units like mass, time and length and the dimension formula of joule = ML2T-2