City students who attend charter schools make monumental strides in achievement over kids who apply to charter schools but don’t actually enroll, according to a bombshell and potentially landmark study.

The Stanford University study — which compared kids who won seats in charter-school lotteries with kids who lost and subsequently enrolled at traditional public schools — was the most comprehensive look at the city’s charter schools to date.

It found that students who win spots in charter schools outgain those who don’t by 5 points in math and 3.6 points in reading on state tests in every year from fourth to eighth grades.

The cumulative difference means students who attend charter schools from kindergarten through eighth grade can close about 86 percent of the achievement gap in math with students in a high-performing, suburban district like Scarsdale, the study found.

They can close the achievement gap in reading by about 66 percent.

Landing a seat in a charter high school also raises the likelihood that students will graduate with a Regents diploma by 7 percent for each year they spend at the school, the study found.

“The results suggest that the charter schools are starting with the most disadvantaged students in New York City, and they’re able to close the achievement gap very considerably,” said Stanford economics professor Caroline Hoxby, who wrote the report.

The study compared the achievement of about 21,000 kids in city charter schools with that of about 19,000 kids who applied to but couldn’t attend charter schools because of a lack of seats.

The apples-to-apples comparison allowed researchers to conclude that charter schools weren’t getting better results by skimming the best students — as some critics have charged.

The results spurred charter supporters to question the rationale behind the state’s cap of 200 charters — which is currently 38 schools shy from being met.

“What the study confirms for me is that having an artificial barrier and a cap on charter schools, where we know that in New York City and New York state they are succeeding, makes no sense,” said James Merriman, CEO of the New York Center for Charter School Excellence.