Park Slope kids are getting a real-life lesson in segregation.

Students in four schools sharing one building have separate sports teams — with more athletic opportunities and resources going to kids from an exclusive school than to three others with mostly black and Latino students.

The alleged “separate and unequal” treatment — now at the heart of a Manhattan federal lawsuit against the DOE — outrages staffers and parents in the John Jay Educational Campus, which formed in 2001. The highly selective Brooklyn Millennium HS opened in the building six years ago.

Normally, when multiple DOE schools occupy the same building, their students share the same sports teams.

But Brooklyn Millennium, which admits kids based on grades and test scores, has refused to join three other schools — Park Slope Collegiate, Secondary School for Journalism, and John Jay School for Law — in the 7th Avenue building. Instead, it hooked up with its older sibling, Millennium HS in downtown Manhattan.

Together, the two elite schools have gotten twice as many teams sanctioned by the Public School Athletic League — and a lot more money — than the other schools in the John Jay building.

Students from Millennium HS in Manhattan even come to Park Slope to use the John Jay pool and gyms.

“It’s a Jim Crow system in Brooklyn in 2017, and it’s shameful,” said Ernesto Mestre-Reed, a novelist and Brooklyn College professor whose daughter Bella, 12, attends middle-high Park Slope Collegiate at John Jay.

Mayor de Blasio, who’s from Park Slope, campaigned against the “tale of two cities,” but has barely tackled the lack of diversity in city schools, the nation’s most segregated.

“He promised to fight it, but he’s done almost nothing,” Mestre-Reed fumed.

Last year, the two Millennium schools had 17 PSAL teams, from baseball and basketball to fencing and table tennis.

The three other schools — and a nearby small school invited to join the John Jay teams — had four. Five track teams were added in the fall, giving the schools nine teams in all.

According to records published by DNAinfo, the Millennium schools received $115,255 in city money for coaches and other sports expenses in 2014-15. The other John Jay schools got $41,045.

Millennium’s red and white banners and signs with the girls’ PSAL swim team’s Phoenix logo adorn the John Jay basement pool.

But students from the building’s other high schools could only join unofficial swim “clubs” until March, when the PSAL agreed to grant John Jay six new teams.

Experts believe the de Blasio administration caters to affluent parents who flock to selective schools.

“He’s allowing Millennium to build its brand at the expense of other students, emphasizing exclusivity over inclusion,” said Brooklyn College and CUNY Graduate Center education professor David Bloomfield. “It is a demonstration of his hypocrisy.”

The controversy erupted in January, when Park Slope Collegiate principal Jill Bloomberg asked PSAL officials to merge all sports teams in the John Jay campus.

“I don’t know of any other campus where the teams are not united,” Bloomberg said last week.

Millennium HS in Manhattan had 25 percent black and Hispanic students, and Brooklyn Millennium 51 percent, she wrote in her e-mail to PSAL. But black and Hispanic students make up 85 to 91 percent of John Jay’s other schools.

She said the PSAL had repeatedly denied John Jay teams for multiple sports, while the Millennium teams “continue to grow.”

But Brooklyn Millennium principal Kevin Conway opposed her bid to “dismantle” Millennium’s teams, saying they have invested “tens of thousands of dollars” in them and that combining the programs would mean more competition for roster spots and playing time.

In March, the DOE told Bloomberg she was under investigation for “Communist organizing.” Bloomberg sued the DOE for what she claims is retaliation.

Later that month, the PSAL granted John Jay boys’ swimming, volleyball and baseball, and girls’ swimming, softball and flag football.

The city Department of Education defended the division of teams.

“Schools located on a campus can request to affiliate with schools at other locations, and the leadership at Millennium Brooklyn and Millennium Manhattan chose for their schools to compete together,” said spokesman Michael Aciman.