A 23-year-old teacher at a New Jersey prep school sneaked into two teen boys’ dorm rooms and touched them as they slept, authorities say.

Dominic Brown, who taught history at the high-end Lawrenceville School, was busted Monday and charged with two counts of aggravated criminal sexual contact and two counts of endangering the welfare of a child, according to the Mercer County Prosecutor’s Office.

Brown — who was in the second year of his fellowship at Lawrenceville, a private boarding school in Lawrenceville, New Jersey, where he also coached water polo — is accused of inappropriately touching the two teen boys early Saturday.

The teens reported the alleged creepy behavior to campus public safety, which is when the cops got involved, according to the prosecutor’s office.

The headmaster of the high school, which charges nearly $70,000 a year in tuition, said he fired the teacher and banned him from the campus.

“This incident is deeply troubling and violates the foundation of trust that our community holds between adults and the students in our care,” the school’s headmaster, Stephen Murray, wrote in a statement to the community. “Nothing in the teacher’s background check or references would have led us to believe he would act in this manner.”

The school said it was offering counseling to the victims.