Here is an excellent tutorial of using the Premack principle to address a similar issue with "fence fighting". Fence fighting was reinforcing for the dog in the video so if running around with the train is a positive experience for Milosh you can use this approach as well…particularly if running around with the train is a bigger reward for him than a treat or a flirt pole. You can use the same approach to build focus in other highly distracting situations as well. If you practice reorienting and checking in a lot when the train is not around it will help. You would probably need to keep him on a check cord like Debra said and combine that with the train schedule.
As a side note, Premack is used a lot in Control Unleashed training approaches.