Actually there is a scenario in which steam engines could replace diesels. Not because of efficiency but of necessity.
The sun (good old sol) puts out a truly gigantic MCE (Mass Coronal Ejection) that fries absolutely every transistor and solid state device on earth no matter how well shielded. Nothing incorporating one would work. My old motorcycle with a carburetor would - your brand spanking new Corvette with computerized fuel injection would not. Basically its back to the 1920's or 1930's before any solid sate device was invented. Yes we would still know how to make them but the machinery to do so wouldn't work ether as is all computer controlled as well. Worse - the machines to make the machines to make the machines and so on wouldn't work either for the same reason.
A highly unlikely event but not impossible. Steam engines were built before the transistor and computer control and could be again, lol.
Vacuum tubes anyone?
Ben (amateur astronomer)
It wouldn't knock us back that far, that we'd need Steam engines. Long before "solid state" electronics, and even up until the mid 90's, diesel engines have been 100% mechanical (computer controls not needed, except to meet EPA regs...oh, that nasty EPA again...)
The electric motors and generators would not be affected either, as all they are are copper wires wound around steel plates, combined with magnets...
Yes, a massive EMD/MCE would make significant impact on society, but Diesel Locos would survive it.
As for the OP, simply put, Steam engines are not efficient. (external combustion)...create fire to produce heat to boil water to make steam to create force/energy to push the piston that pushes the rod that pushes the crank pins that rotates the wheels which activate and set in motion the valve train which directs the energy (lots of parasitic loss).
Diesel engine: inject fuel, compress, ignite, create force/energy, spin generator, make energy, power motors.