The star witness in prosecutors’ case against John “Junior” Gotti told jurors it was so agonizing to implicate his best pal that he vomited thinking about it.

But Michael “Mikey Scars” DiLeonardo went ahead anyhow, despite evidence that Junior passed up a shot at doing the same to him less than two years before.

“What am I doing here?” DiLeonardo said he asked himself as sat down for a 90-minute meeting with a room full of feds in November 2002.

“I was sick,” he said. “I couldn’t believe I actually walked into that office.”

But DiLeonardo, now 50, followed through – trading a lifetime of Gambino family secrets for a cooperation agreement.

Prosecutors hope he can help them nail Junior for the 1992 attempt on the life of radio personality Curtis Sliwa.

A previous trial on the same charges ended with a hung jury last summer.

In his second day on the stand in the retrial in Manhattan federal court, DiLeonardo told of wearing a wire during two weeks he was out on bail – and throwing up every time he strapped it on.

“I was completely distraught,” he said. “Confused. Riddled with guilt. Breaking every code I knew.”

That’s when the longtime mobster – who said he openly cheated on his wife from the day they were married – considered honor.

“I started to think about history,” DiLeonardo told the jury, his voice cracking and breaking. “Maybe dying like a good soldier. Thinking about the Romans. Drink a little wine, slit your wrists.”

DiLeonardo even once choked down a mouthful of sleeping pills, but survived.

He started down his path to the witness chair soon after his 2002 arrest – when visiting wiseguys told him they were taking away his lucrative stock-swindle rackets.

“It means they broke me,” he said. “I’m property of the Gambino family but I’ve got no say, no power.”

But DiLeonardo also conceded that Junior gave up a chance to turn rat in 2001 when DiLeonardo was on trial for separate murder charges.

Gotti’s defense team wasted no time painting DiLeonardo as a liar and philanderer. Lawyers cross-examined him about the 2000 christening of his out-of-wedlock son Anthony, in a ceremony hidden from his then-wife.

Lawyer Charles Carnesi pointed out that DiLeonardo even broke the mob codes of avoiding stocks and bonds – codes he swore and oath to at his induction as a made man in 1988.

“You were to begin your life in organized crime by lying, correct?” he asked.