Mayor Bill de Blasio on Thursday skipped an NYPD swearing-in ceremony made somber by this week’s assassination of a cop — then hours later revealed he was busy preparing to jet off on a surprise trip to join leftist protesters at the G-20 summit in Germany.

Hizzoner’s overseas jaunt was kept under wraps until just 90 minutes before he took off from Newark Airport. A last-minute announcement said he “will attend several events surrounding the G-20 Summit, including Saturday’s Hamburg Zeigt Haltung rally.”

De Blasio will be the keynote speaker, organizers of the demonstration — Hamburg Shows Attitude — tweeted.

The mayor also made sure the free trip will include a visit with his son, Dante, a Yale University student who’s spending the summer on an internship in Berlin, a City Hall spokesman said.

Presumptive Republican challenger Nicole Malliotakis accused de Blasio of abandoning pressing issues in the Big Apple to pursue his progressive agenda in Europe.

“Unbelievable. Instead of jet-setting around the world, he should be here doing his job,” said the Staten Island assemblywoman. “A police officer was murdered, street homelessness has skyrocketed and people continue to get delayed on the trains.”

Malliotakis — who later tweeted a doctored image showing de Blasio in an Alpine hat and lederhosen, grinning behind a plate of bratwurst, wienerschnitzel and Pilsner glasses — also blasted him for blowing off the NYPD ceremony at the Police Academy in Queens.

“The mayor should be embarrassed by the way he has treated the men and women of our police department,” she said.

The head of the NYPD sergeants union also attacked de Blasio.

“As the city mourns, its leader flees,” Ed Mullins said. “And then he wonders why he has a problem with the police. A real leader stays with the city in this time of hardship.”

Less than five hours before de Blasio’s flight to Berlin, NYPD Commissioner James O’Neill offered reassurance to 524 new recruits in the wake of Wednesday’s slaying of Officer Miosotis Familia.

The 12-year veteran and mom of three was shot in the back of the head by cop-hating ex-con Alexander Bonds , who opened fire through the window of a mobile command center vehicle.

O’Neill told the recruits he was sure many family members “are questioning whether you’re making the right decision, especially after yesterday’s tragedy in the Bronx.”

“I’m here to tell you, you are making the right decision,” he insisted.

Asked why de Blasio — who spent the day holed up at Gracie Mansion — didn’t join O’Neill to help rally the recruits, spokesman Eric Phillips replied: “Scheduling conflicts.”

O’Neill later offered his condolences to Familia’s 12-year-old twins, Delilah and Peter, during a visit to their home in the Bronx.

“There are so many young officers that have never been through this before and for the next couple of days it’s going to be very difficult for them and for the family, too,” he said.

“That’s why I stopped by. To let them know that I’m here to support them.”

De Blasio was joined on the trip by Phillips and two other aides, whose travel expenses are also being picked up by Hamburg Shows Attitude.

Phillips said the gifts were approved in advance by the city Conflicts of Interest Board, whose general counsel said it was “prohibited by law from disclosing any information regarding advice we provide.”

In October, de Blasio told a class of NYPD recruits, “We honor you for making this choice,” before adding that “what we owe to you is every effort to keep you safe.”

Following Familia’s slaying, her sister, Adriana Sanchez, ripped de Blasio, saying that “the mayor has to do something for this madness to stop,” and that windows on NYPD vehicles should have been made bulletproof “a long time ago.”

Later Thursday, following de Blasio’s departure, City Hall announced a $1.3 million plan to outfit “all NYPD command vehicles used by uniform personnel” with bullet-resistant window panels and other safety upgrades.

The city had already earmarked $10.4 million for window panels in 38,000 patrol vehicles, with 151 equipped as of Wednesday, according to the NYPD.