James O’Neill, who was publicly sworn in yesterday as NYC’s 43rd police commissioner, is nothing if not a humble guy. Decent and smart, he started as a transit cop and rose to chief of department, the NYPD’s highest uniformed position.

O’Neill’s success will largely hinge on how he handles crime and public safety — including investigations like the one underway into the Chelsea explosion that led to 29 injuries.

“It’s a pretty tough way to start my new position,” O’Neill said yesterday after Ahmad Kahn Rahami was taken into custody in the explosions in Chelsea and in New Jersey.

Also important to O’Neill’s success is how he copes with Mayor Bill de Blasio, who is distrusted by much of the NYPD and who has sagging approval ratings. Specifically, O’Neill must keep de Blasio out of the NYPD’s daily business, à la the mayor’s midnight telephone call to a deputy chief six weeks after becoming mayor that led to the release of a prominent political supporter held on two warrants.

“Everyone is going to leverage him for his favorite guy. They will come at him from all sides,” a former top cop said of O’Neill’s potential travails.

“It’s not just the mayor,” the former official said anonymously to speak frankly about the transition at the NYPD. “He’s going to hear it from everyone who wants to promote his own people. He’ll get dozens of calls. You tell them thanks for the info and then put them off.”

As commissioner, O’Neill also inherits two simmering issues.

First is the discovery that Officers Daniel Pantaleo and Richard Haste have racked up a ton of overtime while on modified assignment. They were reassigned after their actions in the deaths of Eric Garner in Staten Island and Ramarley Graham in the Bronx, respectively. O’Neill has said that in the future, the commissioner must approve such overtime.

Second is the sudden justification for keeping secret the disciplinary records of cops — in particular Pantaleo’s. The change occurred after the department’s resident legal genius, Larry Byrne, deputy commissioner for legal matters, concluded that releasing cops’ disciplinary records violates state law. For the past 40 years, the department has released such records.

O’Neill can, of course, reverse Byrne, although that seems unlikely. Reversing Byrne would, in effect, be reversing the mayor. Perhaps the best he can do is order Byrne to keep his opinions to himself.

Meanwhile, former Commissioner Bill Bratton, who left the NYPD on Friday, is off to the private sector to a company connected to the Clintons. He says his career in law enforcement is over, and that he won’t return to the public sector.

Don’t bet the ranch on that.