A New Jersey appeals court has blasted a state family court judge — and reversed his decision — after he refused to try as an adult a 16-year-old boy accused of raping an intoxicated 16-year-old girl and sending video of the alleged sex assault to his buddies.

In a ruling last year in Monmouth County, New Jersey Superior Court Judge James Troiano denied prosecutors’ motion to try the teen as an adult and instead said: “This young man comes from a good family who put him into an excellent school where he was doing extremely well.”

“He is clearly a candidate for not just college but probably for a good college. His scores for college entry were very high,” said Troiano, who also detailed the boy’s extracurricular activities, including that he was an Eagle Scout.

Prosecutors say the boy, only identified in court documents as G.M.C., sexually assaulted the girl while at a pajama-themed basement party packed with about 30 other adolescents in New Jersey where alcohol was flowing.

The drunken boy had walked off to a closed-off, darkened area of the room with the visibly drunk victim and filmed himself on his cellphone penetrating the girl from behind with her bare torso exposed and her head hanging down, according to prosecutors.

He then sent the clip to several friends, and in the days following the incident, texted his pals, saying: “When your first time having sex was rape.”

In denying the waiver to try the teen as an adult, Troiano noted: “I still in my mind … distinguish between a sexual assault and a rape … in my mind there is a distinction.”

“There have been some, not many, but some cases of sexual assault involving juveniles which in my mind absolutely were the traditional case of rape,” said the judge, who added that those cases generally involved two or more males and a gun or weapon.

The judge expressed concern that the prosecutor did not indicate that she explained to the victim and her mother “the devastating effect a waiver would have on G.M.C.’s life,” according to the appeals court.

The appeals court last month reversed Troiano’s ruling, paving the way for the case to be moved from family court to a grand jury, where the teen boy will be treated as an adult, the New York Times reported.

“That the juvenile came from a good family and had good test scores we assume would not condemn the juveniles who do not come from good families and do not have good test scores from withstanding waiver applications,” the appellate panel said in the 14-page ruling.

Troiano is one of two family court judges whom appeals courts in New Jersey have admonished in recent weeks over similar cases, the Times reported.

The appellate decision reversed Middlesex County family court Judge Marcia Silva’s decision to not try a 16-year-old boy as an adult after he was accused of sexually assaulting a 12-year-old girl in 2017.

Silva had said in court that even if the girl’s claim was true, “the offense is not an especially heinous or cruel offense beyond the elements of the crimes that the waiver statute intends to target,” NJ.com reported.