A captain of the St. John’s University men’s lacrosse team stabbed and nearly gutted his roommate during a scuffle, police said Wednesday.

The dust-up began when Matthew Stockfeder, 21, apparently woke his roommate up by playing loud music in their off-campus Queens apartment late Monday, according to law enforcement sources.

The roommate, Justin Corpolongo, 23 — a 2018 university alumnus who used to play on the lacrosse team — told Stockfeder to shut off the tunes, sources said.

So Stockfeder booked it to a home two blocks away on 172nd Street around 73rd Avenue in Flushing to hang out with his teammates who lived there.

But the captain repeatedly texted Corpolongo, apparently prompting the rival to show up at the house, police and sources said.

The two men squared off, and the victim tried multiple times to punch Stockfeder, according to a criminal complaint unsealed in Queens court Wednesday afternoon.

At one point, the victim was holding Stockfeder’s head down when he suddenly “felt a sharp pain to his abdomen,” the complaint states.

He “looked down to see that he was bleeding profusely” — and realized he’d been stabbed.

Corpolongo was rushed to NewYork-Presbyterian Hospital in Queens, where doctors determined that a 4- to 5-inch puncture to his small intestine was likely caused by a knife, the complaint states.

He needed surgery but was expected to survive, according to the complaint.

The lacrosse player surrendered to police with his lawyer Wednesday morning.

Police interviewed four people in the house at the time of the brawl, sources said.

Stockfeder, a senior from Melville, LI, was ordered held on $5,000 bail by a Queens Criminal Court judge. His lawyer, Anthony Como, did not immediately return a phone call.

St. John’s said in a statement that it was aware of the incident and was cooperating with authorities.

Residents of the house refused to speak to a Post reporter Wednesday. A red St. John’s flag could be seen through the window.

“I was shook,” St. John’s marketing junior Melissa Perez, 20, told The Post. “That’s kinda insane that the captain of the lacrosse team would do something like that.

“I heard it was about music being too loud or something, that’s a pretty extreme reason to stab someone.”

A 22-year-old senior business major who gave her name as Evelyn said the lacrosse team has a reputation as “just crazy party boys.”

“When it comes to sports, they’re fine. But the parties off campus are a whole other scene,” she said.

Stockfeder graduated from Walt Whitman High School in Huntington Station, where he played midfield on their lacrosse team as a starter and captain, according to an online profile.

He was no longer listed on the lacrosse team’s online roster as of Wednesday. A link to his profile on the St. John’s athletics website went to an error message.

Additional reporting by Alex Taylor and Garrett Downs