Yes😜
I think the best way to train for these type of efforts is to ride your MTB. Second best might be to practice some plyometrics, even squats may be beneficial.
The trainer won’t give you the same type of resistance. Spanish Needle may still be useful to increase your lactate clearing abilities both on the MTB and on your road bike.