What’s Mayor Bill de Blasio going to do about a successor to Bill Bratton, now that the NYPD commissioner has reiterated he won’t remain beyond 2017?

Twenty years ago under Mayor Rudy Giuliani, Bratton pulled a similar stunt. During a news conference, he said he would leave for a million-dollar offer in the private sector. Giuliani — who was feuding with him over who deserved credit for the city’s dramatic crime declines — fired him.

In repeating his intent to leave last week, Bratton, who police sources say may leave even earlier, mentioned Chief of Department James O’Neill as a possible successor.

De Blasio has graciously said Bratton can keep the job as long as he wants it. Still, the mayor has options for a successor.

O’Neill, who is smart, dedicated and friendly with the mayor, may be the safe — and even the best — choice. But with a tidal wave of anti-police sentiment sweeping the nation, de Blasio’s progressive supporters care little for Bratton. His signature broken-windows policy, which 20 years ago was heralded as a game-changer against crime, is now viewed as having led to thousands of young black men to prison.

Bratton also has been critical of Black Lives Matter, which the mayor and his wife, Chirlane McCray, have praised.

What better way to appeal to his base and assert his independence from Bratton than for the mayor to bypass O’Neill and appoint a person of color — say, First Deputy Ben Tucker, who is black?

There’s also the outside option. First among equals would be Dallas Police Chief David Brown, who seems to have it all — black, respected and judging from his demeanor after the assassination of five Dallas police officers, sensitive to police and the black community.

But appointing someone outside the department has proven perilous. Under Giuliani, Bratton had recommended that his then-first deputy, John Timoney, succeed him as commissioner. Instead, Giuliani appointed his chum, Howard Safir, who had been fire commissioner. Giuliani told Timoney he could remain as first deputy but when Timoney then called Safir a “lightweight,” Giuliani forced him out of the department.

Safir was seen as Giuliani’s water boy. For example, after the fatal police shooting of Amadou Diallo in the Bronx, Safir went along with Giuliani’s refusal to conduct an internal investigation.

After Mayor David Dinkins’ appointment of Lee Brown of Houston, NYPD leadership was so bifurcated that in the first days of the Crown Heights riots, no one knew who was in charge. Long after the NYPD’s internal affairs unit failed to nab crooked cop Mike Dowd and his five-man band of drug-dealing Brownsville officers, or spot the systemic drug-dealing in the 30th Precinct’s midnight tour, Brown was still calling the NYPD’s internal affairs unit the greatest in the country.

On the other hand, Bratton himself was an outsider and he did pretty well.

All this, of course, presupposes that de Blasio will be re-elected.