A line from Okehampton to Plymouth via Tavistock would go through parts of Dartmoor National Park and cost hundreds of millions of pounds.
David Cameron told BBC Spotlight the UK was "a wealthy country" that should be making long-term investments in rail.
The Dawlish line connects Plymouth and Cornwall to the rest of the UK.
The BBC discovered last year that Network Rail was looking at an additional inland alternative to the Dawlish line that was closed by storms in 2014.
Mr Cameron said the Okehampton line was "worth a long, hard look".
Asked if the Okehampton line was "top of the list" of alternatives to Dawlish, Mr Cameron replied: "That is the one people say could make the most resilient line.
"But we've obviously got to look at resilience, we've got to look at value for money, we've got to look at what is practical."
Mr Cameron said he was "not put off" by the cost of the scheme, which would serve as a back-up route in case of problems at Dawlish.
He said: "These things do cost money but if you want a resilient railway line, you have to spend some money."
Tudor Evans, Labour leader of Plymouth City Council, said he was "puzzled" by the prime minister's comments.
He said: "The region is working with the Department for Transport on assessing the south west plan for future-proofing the railway.
"If the Dawlish line went down, or if the cliffs collapsed, the prime minister is suggesting that traffic would need to be diverted via Okehampton - adding to the journey time to London and removing the railway from most of the passengers in the south of the county."
The prime minister has backed a new Okehampton railway route as the "most resilient" alternative to the vulnerable Dawlish line in Devon.