They became instant war heroes by foiling a suicide bomber trying to sneak into US soldiers’ quarters in Afghanistan, and as a reward, they’re getting homes — and lots of doggie treats.

Three stray mutts — Rufus, Target and Sasha — were living near Sgt. Chris Duke and other US troops on a remote military base in Afghanistan on Feb. 22 when they spotted the bomber outside a building where 50 soldiers were sleeping.

Rufus bit the Taliban terrorist on the leg as Target and Sasha barked furiously.

Several soldiers — unaware of the imminent danger — tried shouting down the mutts. But the dogs continued barking, spooking the bomber into prematurely setting off 24 pounds of C4 explosives before he could get through the door — and killing himself.

Rufus and Target were seriously wounded. Tragically, Sasha died.

“There isn’t a doubt in my mind [that the dogs] saved my life,” said Duke, who was wounded by shrapnel — and is now adopting Rufus.

Five soldiers, including Duke, were evacuated for medical treatment after the blast. But Duke, a National Guardsman, eventually returned to the base near the Pakistan border and nursed Rufus back to health.

It was the least he could do, he said. When Duke was homesick, Rufus picked up his spirits. And when Duke stood watch, Rufus hunkered down beside him.

But Duke said he never thought he would see his canine pal again after finally returning stateside in March.

That’s when several nonprofit groups got involved.

“The dogs and the soldiers bonded in such a way that it would be a travesty to leave [the dogs] behind to fend for themselves in a war-torn area and the soldiers never knowing what happened to them,” said Robert Misseri, of Robert’s Cause, a nonprofit animal-advocacy group. “It’s our mission to help these soldiers.”

Another good Samaritan, Anna Canaan, 23, whose fiancé, Christopher Chiasson, is a soldier currently stationed at the same Afghan outpost in the Dand aw Patan district, created the Puppy Mission Rescue Facebook page to help the dogs.

Today, Rufus arrives in Manhattan before flying to Augusta, Ga., where he will spend the rest of his years with Duke and his wife, who is pregnant. Target, being flown out at the same time, will live in Phoenix with the Army medic who saved her life.

cynthia.fagen@nypost.com

