The incident took place near Ujhani Railway station when gangmen Dilip (32) and Hasif (30) were inspecting the railway line.
Due to severe cold both of them had covered their ears and probably could not hear the approaching train, police said.
The bodies have been sent for postmortem.
A probe has been ordered by railways.