He made the ultimate sacrifice for his best friends.

An Upper West Side couple is mourning the loss of their hero husky, Rikku, who saved them from a fire early Friday morning but perished before he could escape.

The two-alarm fire broke out on the second floor of a five-story building at West 76th Street near West End Avenue at 1:35 a.m., the FDNY said.

Engaged couple Quinn Demarest and Monica Molina were sound asleep in their first-floor apartment when their beloved dog came into the bedroom to wake them up and alert them to the inferno.

“He woke us up, I helped my fiancée out,” Demarest told The Post while recovering from the blaze.

But the couple, thanks to Rikku, fled to the hallway, pulled an alarm and started knocking on doors to alert neighbors the apartment building was filling with smoke and it was time to get out.

“[Rikku] let us knock on the doors and set off the alarm that saved everyone,” Demarest said.

Once Molina was safely out of the building, Demarest went back for Rikku, but it was too late.

“I came back, but the fire was too big. I couldn’t get him out,” the heartbroken dog dad said.

He was too distraught to say anything else about Rikku, but photos on his and his fiancée’s Facebook pages show Rikku playing in the park, frolicking in the snow and trying on silly Halloween masks.

“It is still very raw. I cannot talk about him now,” Demarest said.

Another resident who lives on the first floor also said she was suddenly awoken when the fire broke out.

“I heard screaming from the hallway,” Eve Lederman, 27.

“I was like whatever, but then I kept hearing the screaming, I turned on my light just to see what’s going on, and there was just water everywhere, black smoke.”

William Joyce, 60, a lawyer who lives in the building next door, said he immediately ran outside when he smelled smoke.

“As soon as we stepped outside we saw this inferno bellowing out of that window,” Joyce said. “It was like a movie.

Seven civilians and one firefighter were taken to the hospital with non-life threatening injuries. The FDNY, which dispatched 25 units and 106 firefighters and EMS workers to the fire, has not determined the cause of the blaze.