Four years after New York City Mayor Bill de Blasio railed against the way students are admitted to some of the city’s top high schools on the campaign trail, black and Hispanic students are still rarely accepted into the elite schools.

Only 3.8 percent of offers to attend eight specialized high schools went to black students and 6.5 percent went to Hispanic students this year, according to data released Wednesday, though those populations comprise about 70 percent of city students. The vast majority of eighth graders who received offers were white or Asian.

Students are admitted to eight of the specialized high schools based only on their scores on the high-stakes Specialized High School Admissions Test. And while those schools represent just one subset of New York City’s top high schools, their long history of serving top students — and the rapid decline of diversity at those schools over the last two decades — has put them at the center of a contentious debate about whether the city is doing enough to help black and Hispanic students succeed.

This year, a total of 5,078 students received offers to the eight schools, about the same number as last year. Only one black student was admitted to Staten Island Technical High School, and 13 were admitted to Stuyvesant High School, two of the schools where the number of black students admitted has recently been in the single digits.

“While there are many promising trends this admissions cycle … it’s clear there is much more work to do,” Schools Chancellor Carmen Fariña said in a statement.

Since state law requires the test-based admissions system at some of the schools — and support for changing that law has been meager — the city’s plan to boost diversity focuses on test preparation and encouraging most black and Hispanic students to take the exam.

The six-point plan, announced in June, includes more test preparation programs, an “SHSAT day” at certain schools, and student outreach. Twenty-six percent of black and Latino offers went to students who participated in the DREAM program, which prepares students for the SHSAT and the city plans to expand.

The city noted that more students took the test this year in districts and schools the city targeted for SHSAT outreach. The number of students testing at schools that piloted a SHSAT day increased over 50 percent.

Approximately 28,000 students took the test last fall, with an increase among Latino test takers, according to the city’s data.

The city also plans to change the test itself to make it “fairer and more equitable.” Starting this fall, the test will be lengthened and some unpopular sections, like scrambled paragraphs, will be scrapped.

Though a lack of diversity at the city’s eight specialized high schools has been the focus of public discussion, there is also a gap among all New York City high schools.

A Chalkbeat analysis found that over half the students who took and passed the eighth-grade state math exam wound up in less than 8 percent of city high schools. Meanwhile, nearly 165 of the city’s roughly 440 high schools have five or fewer incoming ninth-graders who took and passed the state math test.