Serial killer Jeffrey Dahmer was done in by his uncontrollable lust for human flesh, the man who whacked him in prison 20 years ago told The Post, revealing for the first time why the cannibal had to die.

Christopher Scarver — who fatally beat the serial killer and another inmate in 1994 — said he grew to despise Dahmer because he would fashion severed limbs out of prison food to taunt the other inmates.

He’d drizzle on packets of ketchup as blood.

It was very unnerving.

“He would put them in places where people would be,” Scarver, 45, recalled in a low, gravelly voice.

“He crossed the line with some people — prisoners, prison staff. Some people who are in prison are repentant — but he was not one of them.”

Scarver, who arrived at Wisconsin’s Columbia Correctional Institution around the same time as Dahmer in 1992, knew right away to keep a safe distance from the serial killer.

Scarver said the madman had a personal escort of at least one guard at all times when he was out of his cell because of his friction with other inmates.

“I saw heated interactions between [Dahmer] and other prisoners from time to time,” Scarver said, adding that he didn’t think much of Dahmer.

“There was no impression,” he said.

Like a lone wolf, Scarver watched Dahmer from afar on the prison yard, but never approached him, because he did not want to become a target of his sickening humor.

“I never interacted with him,” he said.

But that all changed on the morning of Nov. 28, 1994, when Scarver doled out his vigilante justice in a gymnasium of the Portage, Wis., prison.

Dahmer, 34, Scarver and a third inmate, Jesse Anderson, were led unshackled to clean the bathrooms by correction officers, who left them unattended.

Scarver, who was repulsed by the youth-molesting cannibal’s lust for flesh, kept in his pocket a newspaper article detailing how Dahmer killed, dismembered — and in some cases ate — 17 men and boys from 1978 to 1991.

Scarver, then a 25-year-old convicted murderer, had just retrieved his mop and was filling a bucket with water when someone poked him in the back.

“I turned around, and [Dahmer] and Jesse were kind of laughing under their breath,” Scarver recounted. “I looked right into their eyes, and I couldn’t tell which had done it.”

The three men then split up, and Scarver followed Dahmer toward a staff locker room.

Scarver grabbed a metal bar from the weight room and confronted Dahmer with the news story he had been carrying in his pocket.

“I asked him if he did those things ’cause I was fiercely disgusted. He was shocked. Yes, he was,” Scarver said.

“He started looking for the door pretty quick. I blocked him,” Scarver said.

With two swings of the bar, Scarver crushed Dahmer’s skull.

“He ended up dead. I put his head down,” he said.

He then casually crossed the gym and entered a locker room where Anderson, 37, was working.

“He stopped for a second and looked around. He was looking to see if any officials were there. There were none. Pretty much the same thing [happened] — got his head put out,” Scarver said of Anderson, who was serving a life term for killing his wife in 1992.

Scarver believes it was no accident that he ended up alone with Dahmer — since prison officials knew he hated the madman and they wanted him dead.

“They had something to do with what took place. Yes,” said Scarver, noting that the guards disappeared just before he clobbered Dahmer with the 20-inch, 5-pound metal bar.

But Scarver refused to elaborate out of fear for his own safety.

“I would need a good attorney to ensure there would not be any retaliation by Wisconsin officials or to get me out of any type of retaliatory position they would put me in,” Scarver said.

Wisconsin Correction Department spokeswoman Joy Staab did not return calls for comment about those claims — but an investigation following the killings determined he acted alone.

Scarver initially pleaded insanity to the murders but later changed it to “no contest” in exchange for a transfer to a federal penitentiary.

He was sentenced to two life terms on top of the life sentence he was already serving.

Scarver was locked up for killing his former boss during a robbery in 1990.

After getting fired from a job-training program at the Wisconsin Conservation Corps, Scarver started drinking heavily and said he heard voices that called him “the chosen one.”

He returned to his former workplace with a .25-caliber semiautomatic pistol and demanded cash from site manager John Feyen. When he gave only $15, Scarver put a bullet in the head of a

worker, Steven Lohman.

He shot Lohman two more times before Feyen knocked the gun out of his hands and ran off.

Hours later, cops arrested Scarver sitting on the stoop of his girlfriend’s apartment building.

After the killings, Scarver bounced from prison to prison until he landed at his current home: Centennial Correctional Facility in Canon City, Colo.

Scarver says he has been evaluated by 10 to 20 prison doctors but still doesn’t understand his mental issues.

He partly blames prison food for his insanity.

“I found out in my own research what the problem is: Certain foods I eat cause me to have a psychotic break — bread, refined sugar,” he said. “Those are the main culprits.”

He now spends his days writing poems for his site. He also has self-published poetry books for sale on Amazon.