It wasn’t until a Wednesday basketball game in Barnegat, N.J., had ended that the coach learned two of his middle school students had allegedly endured racial slurs and other insults while on the court, according to a district official.

One Black student on Lakewood Middle School’s girls basketball team said she was called a “Black b----," Michael Inzelbuch, an attorney for the school district in Ocean County, told The Washington Post. Her teammate, another Black student, was allegedly called “homeless” because of her shoes and was told she should go back to a shelter, Inzelbuch said.

The team from Lakewood Middle School, which has mostly students of color, was facing off against Russell O. Brackman Middle School, which has a predominantly White student body.

“It’s not the first time that our students, who face so many obstacles and challenges, have to deal with this inappropriate behavior,” Inzelbuch told The Post. “Before [the pandemic], there were a series of games involving our high school teams where other racial slurs were occurring.”

In those cases, the attorney said, athletes were called the n-word and “border jumpers.”

The slurs allegedly made on the court Wednesday prompted Lakewood Public School District leaders to file a formal complaint with the New Jersey attorney general’s office asking authorities to investigate the incident, Inzelbuch said. Leland Moore, a spokesman with that office’s Division of Civil Rights, said he could neither confirm nor deny an investigation, citing agency policy.

“DCR is aware of allegations relating to a middle school basketball game between schools from Lakewood and Barnegat, but cannot comment further at this time,” Moore said in an email to The Post. NJ.com first reported the allegations.

The Barnegat Board of Education for Russell O. Brackman Middle School is also reviewing the incident. Superintendent Brian Latwis told The Post in an email that referees and coaches were not made aware of the claims during the game when “they could be addressed immediately.”

”We take these allegations very seriously and have a detailed harassment, intimidation and bullying policy in place,” Latwis added. ”This type of alleged behavior is not tolerated and we are working to determine the validity of these accusations.”

On Friday, Latwis sent a letter to parents announcing an internal investigation had found that the alleged comments were not made by members of the basketball team.

“We were able to determine that several student spectators seated behind Barnegat’s team bench made offensive and insensitive comments,” the letter read. Those students, Latwis added, will face disciplinary actions.

He added, “We extend our sincere apologies to the Lakewood Middle School girl’s basketball team and everyone impacted by this incident. It does not reflect our culture, nor our district-wide efforts to celebrate diversity and promote acceptance and respect.”

Neither Lakewood Public School District Superintendent Laura Winters nor the principals of both middle schools responded to messages left by The Post by early Friday.

The New Jersey basketball game is one of the latest incidents of students and coaches reporting alleged racist taunts against teen athletes.

In July, a Southern California basketball team was stripped of its regional title after members of the mostly White team threw tortillas at a predominantly Latino opposing team. The California Interscholastic Federation, the state’s governing body for high school sports, called the behavior “unacceptable,” “discriminatory” and “racially insensitive.”

In September, a high school football game in Massachusetts ended in a brawl after the head coach of a predominantly Latino and Black school alleged that fans of the rival team called his students racial slurs, likening them to monkeys.

On Wednesday, Inzelbuch told The Post, the team of 19 girls representing Lakewood Middle School’s basketball team traveled nearly 30 miles to Russell O. Brackman Middle School. The first two quarters passed without incident, he said, but the 12- and 13-year-old girls say that in the third quarter, they were taunted by their opponents.

“A lot of our kids come from poverty, so they don’t have basketball sneakers,” Inzelbuch told The Post. “They might be wearing different types of sneakers.”

The girls shared what allegedly happened after the game was over, he said. That’s when their coach spoke to Barnegat leaders about the allegations, Inzelbuch said.

Latwis, the Barnegat superintendent, said officials “would have preferred to address this matter directly and more immediately, rather than be notified about the filing of incident reports through the media.”

On Thursday, Inzelbuch said, the lawyer representing the Barnegat Township School District contacted him to say officials had launched an investigation into the matter.

Lakewood School District took its own actions, Inzelbuch said, by purchasing 10 pairs of sneakers for players who need them. The shoes are expected to arrive by Monday, he said.

“One girl actually called her mother and said, ‘I’m finally able to have a pair of sneakers,’” Inzelbuch recounted. “Another girl was saying, ‘At least they can’t make fun of us anymore for that.’”

Each player also received a white and blue balloon in the team’s colors with a note that read: “We are Lakewood. We are somebody.”