Rail services between Inverness and Perth will resume tomorrow morning.
The line has been closed near Dalwhinnie since Saturday when two rear vehicles derailed during an overnight test.
The derailment caused damage to the train and track, but nobody was injured.
Railway engineers have been on-site working to re-rail the train, repair the damage and get services restored for passengers and freight.
No passengers were on board when the incident happened at around 3am on Saturday.
An investigation is under way into the cause of the incident and Network Rail is working with the Rail Accident Investigation Branch to determine the cause.
Liam Sumpter, Network Rail’s route director for Scotland’s railway, said: “Our engineers have been on-site round the clock since Saturday, working tirelessly to re-rail the train and fix the track as quickly as possible so we can reopen the line on Thursday.
“I would like to thank our passengers and freight customers for bearing with us as we work to get services up and running again on the Highland Main Line.”
Network Rail is also conducting its own investigation into the incident.
David Simpson, ScotRail operations director, said: “We know our customers making essential journeys were affected by the line closure, and we did everything possible to keep people moving with alternative arrangements.
“We have worked closely with our colleagues in Network Rail Scotland to prepare for the reopening of the line, and we look forward to returning services on Thursday.”
Travel information is available at www.scotrail.co.uk