WASHINGTON — Four New York lawmakers got a firsthand glimpse of a historical White House staff shake-up on what was supposed to be a fun trip on Air Force One with President Trump.

But when GOP Reps. Dan Donovan, Peter King, Chris Collins and Lee Zeldin boarded the presidential plane July 28 to Long Island, there was already tension in the air.

Fox News was flashing on TVs in the conference room area of the plane where the four sat with chief of staff Reince Priebus and communications director Anthony Scaramucci. The rivals were at opposite ends and not speaking to each other as newscasters recounted the vile names Scaramucci had called Priebus in a tirade with a reporter.

“It was a little awkward with Reince and Anthony Scaramucci sitting around the same table — needless to say,” Collins told The Post.

By the end of the plane ride, Priebus would be gone, and Scaramucci would be booted three days later in another high-profile ouster at the White House. The swift shake-up caught the lawmakers by surprise.

“No one is going to want to get on an airplane with me — they keep losing their jobs!” Donovan mused.

The four lawmakers were supporting Trump’s effort to stamp out the MS-13 gang and to thank police officers in New York. The trip started off with impressive perks.

They enjoyed stopping traffic as they rode in the presidential motorcade, face time with the president and snagging special White House M&M candy for souvenirs. But they also got a rare glimpse of a transition of power.

“It was a moment in history,” Collins said. “There’s no doubt. I was just honored to be invited on the flight. It was like going to Disneyland and taking my souvenirs and getting photos and then the irony of ironies it played out the way it did.”

The normally confident and gregarious Scaramucci was in the doghouse with the president for his profanity-laced interview with the New Yorker. He confided to King that Trump wasn’t happy.

“He said he got two phone calls — from his mother and the president,” said King, who helped organize the event on Long Island.

Abroad Air Force One, Trump was in his private cabin occupied with North Korea, which had just conducted an intercontinental ballistic missile test. Also on the plane were UN Ambassador Nikki Haley and deputy national security adviser Dina Powell.

On the way back from the MS-13 event, Priebus left the others at the conference table area and went into Trump’s private Air Force One office.

The chief of staff came out with a “poker face” and didn’t let anyone know the stunning news that he had just lost his job. He continued working.

“He gave zero indication whatsoever that that was going to be his last day,” Collins said.

Afterward, Trump met with Donovan in his office. He asked him what he thought of Homeland Security Secretary John Kelly.

He’s an American hero, said Donovan, who serves on the House Homeland Security Committee. Trump was pleased with Donovan’s high praise.

“I told you,” Trump remarked to Powell, who was also in the room, Donovan said.

“The president then told me in 20 minutes he was going to name John Kelly his chief of staff,” Donovan said.

Donovan walked back to the rest of group marveling that Trump confided in him about the big decision. “I know something only one other person in this room knows,” Donovan recalled

At Trump’s urging, he broke the news to the other lawmakers — asking that they keep it quiet until the official announcement.

True to Trump’s style, he made the announcement himself on Twitter as they returned to Washington.

“The reason we were delayed getting off the plane is he was tweeting it as we were on the tarmac trying to get off the airplane,” Collins said. “He has to get off first.”

On his first day on the job, Kelly moved to oust Scaramucci as communications director.