Rep. Jerrold Nadler, chairman of the powerful House Judiciary Committee, nearly collapsed and had to be rushed to a hospital from a Manhattan press conference with Mayor de Blasio on Friday.

Nadler, 71, put his head down and grew pale and disoriented while he was sitting next to de Blasio at the event at PS 199 on the Upper West Side at about noon.

A message posted to Nadler’s Twitter account shortly after the incident read: “Appreciate everyone’s concern. Was very warm in the room this morning, was obviously dehydrated and felt a bit ill.

“Glad to receive fluids and am feeling much better. Thank you for your thoughts.”

During the medical episode, a concerned de Blasio spoke calmly to Nadler and tried to get him to stay alert. The mayor tapped his fellow Democrat repeatedly on the shoulder and tried to hand him a water bottle filled with red Gatorade.

“You seem a little dehydrated, are you OK?” de Blasio asked while trying to get Nadler to focus.

“He started to respond slowly but he wasn’t his normal self, ­obviously,” de Blasio later told reporters.

A disoriented Nadler could barely get words out as the mayor and several other people at the event tried to aid him.

“Code blue in the gymnasium,” someone said over the PA system at the West 70th Street school, where the mayor was announcing new speed-camera safety measures in school zones.

Doctors at the event rushed to Nadler’s side and an ambulance was called as conference organizers cleared the gymnasium of more than 100 guests and reporters.

Nadler appeared to be recovering after being treated by doctors at the scene, but he was placed on a gurney and wheeled to an ambulance out of the sight of photographers and reporters.

He was rushed to NYU Langone Hospital. Hours later, a spokesperson for Nadler insisted the congressman was “back to normal,” but declined to say if he’d been discharged from the hospital.

De Blasio told reporters after the episode that Nadler’s condition improved considerably about 20 minutes after he nearly fainted.

“Congressman Nadler is doing much better,” Hizzoner said. “I spent time with him and the medical personnel and the EMTs who responded. He got more energetic with every passing minute.”

As the ranking Democrat on the House Judiciary Committee, Nadler is locked in a bitter feud with President Trump.

The committee is investigating matters related to special counsel Robert Mueller’s investigation, including whether or not the president obstructed justice.

This week, former White House Counsel Don McGahn refused to appear in front of the committee after it had issued a subpoena for him.

Trump and his legal team ordered McGahn to defy the subpoena, arguing a president’s most senior advisers should not be immune from congressional subpoena power.

Additional reporting by Ben Feuerherd