A man who survived more than three weeks in sub-zero Alaska temperatures was rescued when troopers spotted his “SOS” message scrawled in the snow — and found him looking like Tom Hanks in “Cast Away,” authorities said.

Tyson Steele, 30, a homesteader from Utah, was discovered safe, albeit hungry and cold, last Thursday after fleeing his burning remote cabin in mid-December, Alaska State Troopers said.

“Steele’s shoulder-length hair, chestnut brown near the roots fading to golden blond near its frayed tips, hung matted and dreadlocks-like over his neck,” Alaska State Trooper Ken Marsh wrote in the press release. “His auburn beard flowed untrimmed to his chest. The combination made him seem vaguely reminiscent of actor Tom Hanks’ character in the movie ‘Cast Away.’ ”

Steele’s cabin was all but destroyed by a “big piece of cardboard” he was burning on his woodstove that apparently set the roof ablaze on Dec. 17 or 18, according to the state troopers.

Steele’s 6-year-old dog Phil didn’t survive the inferno — which also destroyed most of his possessions in the cabin about 20 miles outside the village of Skwentna, where he had lived alone since September, according to authorities.

But Steele, who did not have a working phone or a map, survived — initially hunkering down in a snow cave for two days.

“It was just big enough for my sleeping bags and me and a couple things of food,” he said in a press release about the rescue. “And that stayed, you know, snow caves are pretty nice for survival. There’s a lot of insulation. It can be negative 40 outside and if you have a candle – which I didn’t – but if you do, it can be above 30 degrees. But I just huddled into that dark cave and I slept. I slept for a really long time. And it was, it was warm. Warmer than outside.”

Then he scavenged materials from what remained of his cabin to build a makeshift shelter. He rationed some 30 days of food that he was able to salvage.

“Once I got the second shelter built, I kept a fire in the woodstove perpetually,” Steele said. “And I basically use that to heat up my food. It’s not about keeping the shelter warm, because it basically just took that edge off.”

Troopers conducted a welfare check on Steele Thursday after concerned friends said they hadn’t heard from him.

When authorities flew over the remote area in a helicopter, they saw the “SOS message” and spotted a haggard-looking Steele waving his arms for help.

Following his rescue, Steele’s friends accommodated him with a shower, and — at his request — a “McDonald’s Combo Meal No. 2.”

Now, Steele plans to take some time to recover from the ordeal.

“I’m probably going to go back home to Salt Lake City. Not ‘back’ home, because this is my home,” he said of the Alaska wilderness. “But to my family. They’ve got a dog. And that would be some therapy.”