Dimensions describe a quantity in terms of the base quantities mass \(M\), length \(L\) and time \(T\), independent of the units used. The key physical insight here is that tension in a string is simply the force the string exerts along its length. It is not a special new quantity, so it must have exactly the dimensions of force.
Get those dimensions from Newton's second law, \(F = ma\). Mass contributes \(M\). Acceleration is velocity change per unit time, that is \(\frac{L\,T^{-1}}{T} = L\,T^{-2}\). Multiplying: \[[F] = M \times L\,T^{-2} = M\,L\,T^{-2}.\] So the dimensional formula of tension is \(M\,L\,T^{-2}\), whose SI unit, the newton, is correspondingly \(\text{kg}\,\text{m}\,\text{s}^{-2}\).
Watch the sign of the time index. Writing \(M\,L\,T^{2}\) would mean force grows with the square of time, which is dimensionally the same as mass times length times time squared and matches no mechanical quantity here; the index is negative because time appears in the denominator of acceleration twice. An expression with no \(M\) at all, such as \(L\,T^{-2}\), is the dimension of acceleration alone, not of a force, and raising \(M\) to a power other than one has no justification since force is directly proportional to a single mass. Exam takeaway: whenever a question asks for the dimensions of tension, thrust, weight, upthrust or any pull or push, answer with the dimensions of force, \(M\,L\,T^{-2}\).