The incident took place near Shoghi, 14 km from here.
The youth identified as Sanjay Sharma, a student of Industrial Training Institute, was returning home when he was hit by the toy train on Shimla-Kalka section, police said.
The victim was listening to music while walking on the railway track and could not hear the sound of the approaching train, they said.