Boris Johnson’s doctors were prepared to announce his death after he was admitted to an intensive care unit with coronavirus last month.
The prime minister said those around him at St Thomas’ hospital in London were considering “how to handle it presentationally” if he passed away after his condition rapidly deteriorated.
Mr Johnson said he was left needing "litres and litres of oxygen" after “the bloody indicators kept going in the wrong direction”.
"They had a strategy to deal with a 'death of Stalin'-type scenario,” he told The Sun on Sunday.
"I was not in particularly brilliant shape and I was aware there were contingency plans in place.
"The doctors had all sorts of arrangements for what to do if things went badly wrong.”
Latest coronavirus news, updates and advice
The prime minister returned to work earlier this week after spending weeks recovering from the virus and his three-night spell in an ICU.
He said he was "in denial" initially about how serious his illness was, and that doctors were right to "force" him to go to hospital.
"The bad moment came when it was 50-50 whether they were going to have to put a tube down my windpipe,” he added.
"That was when it got a bit... they were starting to think about how to handle it presentationally."
Mr Johnson said it was thanks to “some wonderful, wonderful nursing” that he survived the ordeal which he admitted he was initially “in denial” about.
He said he was initially reluctant to go to hospital with the condition but was eventually persuaded by his advisers who he said were “right to force me to go”.
Despite his worsening condition, however, the prime minister insisted he never feared for his life but said “terrible buoyancy within” convinced him he would pull through.
Two weeks after leaving intensive care he returned to work full-time, and just two days later his fiancee Carrie Symonds gave birth to their son.
The couple named the baby Wilfred Lawrie Nicholas Johnson after their grandfathers, and two doctors - Dr Nick Price and Prof Nick Hart - who helped save Mr Johnson's life.