More New York City students than ever are taking and passing Advanced Placement exams, according to statistics released Tuesday by the education department, which added new AP classes at dozens of schools last year as part Mayor Bill de Blasio’s push to make advanced courses available to more students.

The number of students who took at least one AP test in 2017 increased by 4,458 students citywide — a 10 percent increase over the previous year. Just over 1,800 additional students passed at least one AP exam, a 7.5 percent increase. In all, about one-third of the most recent graduating class took an AP exam, with 18 percent passing at least one of them.

“For too long, our students’ access to AP courses has been dictated by their zip code,” Mayor Bill de Blasio said in a statement. “We are making the investments to right that wrong, and to ensure that every kid has access to the challenging courses they need to be ready for college and careers.”

While white and Asian students are still more likely to take AP exams, test-taking increased among all racial groups this year. However, even as more black and Hispanic students took the exams, the proportion of those who passed actually shrank — widening the pass-rate gap between them and their white and Asian peers.

The number of Hispanic students who took at least one AP exam in 2017 increased by 13.2 percent — more than any other racial or ethnic group. But the proportion of those students who passed at least one exam decreased nearly 4 percentage points from 47.2 to 43.5 percent. Participation among black students grew by 9 percent, but their pass rate dipped slightly from 27.8 to 27.1 percent.

White and Asian students, by contrast, saw both participation and pass rates increase. Roughly 66 percent of white test takers passed at least one exam, while 67 percent of Asian students did — a small increase for both groups.

The education department acknowledged some of those racial disparities in its press release, noting that “the city is moving to address these inequities with the Equity and Excellence for All agenda, including AP for All and Computer Science for All.”

An education department spokesman also pointed out that the overall number of black and Hispanic students taking and passing the exams has gone up.

“This is significant progress, and we hope to build on both the performance and participation increases going forward,” said spokesman Will Mantell.

While more students were beginning to take and pass AP exams before de Blasio’s tenure, he has made greater access to advanced courses a signature part of his education agenda. In 2015, he announced “AP for All,” a program designed to boost the number of AP classes in schools — especially those with low-income students of color who remain less likely to take advanced courses.

A 2015 report by the Center for New York City Affairs at the New School found that more than half the city’s high schools did not offer a single AP course in math and about half did not offer an AP course in science. Currently, about 400 of the city’s roughly 500 high schools offer at least one AP class, according to the city’s education department, an increase of roughly 30 schools over the past year.

As part of AP for All, the city set a goal of that 75 percent of students will be offered at least five AP classes by fall 2018, with all students covered by 2021. As of last school year, 58 percent of high school students had access to at least five AP courses, officials said.

De Blasio has also pushed for more computer science courses, promising all schools citywide will have at least one offering by 2025. The number of students taking an AP computer science exam more than doubled to 3,966 students this year, officials said. Some 71 percent of those students passed — a 13-point increase over last year.