John “Junior” Gotti finally sang – but it was “Happy Birthday” to a federal judge.

Gotti helped Manhattan federal Judge Shira Scheindlin celebrate her 60th birthday by serenading her from his seat at the defense table yesterday.

“I led the attack,” Gotti said outside of court. “Everyone was saying, ‘We’re going to sing, we’re going to sing,’ and then they started chickening out.”

The bizarre and unusual birthday celebration was carried out in the courtroom – which was mysteriously closed to the public – before jury selection in Gotti’s racketeering trial resumed for a third day.

The mob scion was joined singing, “Happy Birthday Judge Scheindlin,” by at least one of his defense lawyers, members of the prosecution team and court personnel.

Gotti and Scheindlin have been through a lot together over the past year.

The former Gambino leader is facing his third trial for racketeering after two previous juries failed to reach a verdict – with all of the trials taking place in Scheindlin’s courtroom.

Later in the day the judge got some chuckles when she agreed to excuse a potential juror who had plans to travel to Paris to celebrate her mother’s 60th birthday.

“I’m particularly sympathetic to 60th birthdays,” Scheindlin said.

Scheindlin’s mini-bash, which lacked gifts and cake, was a private affair.

When a reporter tried to enter the courtroom as the singing was about to begin, deputies with the U.S. Marshals Service said the judge’s deputy had instructed them to bar the public for 10 minutes, but they could not say why.

Courtrooms are typically closed to the public only to protect the identity of cooperating witnesses, undercover agents and the victims of sex crimes, or for national-security concerns.

Legal experts raised eyebrows at the fact that Scheindlin allowed the impromptu fete to occur at all.

“This is not a major violation of judicial ethics. It’s a pimple on the trial,” said David Luban, law professor and legal ethicist at Georgetown University.

“I think she ought to have stopped it. I think any trial judge is perfectly capable of cutting them off if something is not proper. It casts doubt in the judge’s own partiality if the judge allows the defendant to sing ‘Happy Birthday,’ ” said Luban.

“It’s a bizarre situation in the middle of the criminal trial singing ‘Happy Birthday.’ It’s inappropriate,” said Christopher Murray, a civil-rights attorney based in Garden City, L.I.

Opening statements in the trial could take place as soon as this afternoon.