The joule is form of energy and can be written as work done
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/tā2 ( 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