A JetBlue flight captain had to be tackled by passengers today after he ran up and down a packed flight screaming about “terrorism” and “al Qaeda” in a terrifying mid-air outburst.

“Say your prayers!” the crazed pilot screamed as he ran up and down the aisle, a passenger told The Post.

“Someone next to me said he was saying something about bombs,” recounted the passenger, Tiffany Lee, a 26-year-old Las Vegas resident.

The captain was identied as Milwaukee-native Clayton Osbon, according to Fox News.

The Amarillo Globe-News also quoted passengers on board saying the pilot was screaming about al Qaeda.

JFK PILOT RANTS: ‘SAY YOUR PRAYERS…WE’RE ALL GOING DOWN!’

“Iraq, al Qaeda, terrorism — we’re all going down,” he yelled, according to witnesses.

Laurie Dhue, a former Fox News Channel anchor who was on the flight, told the network passengers could hear the pilot using the words “Afghanistan” and “Israel” during the tirade.

The crazed captain’s outburst came after he was booted from the cockpit, passengers said.

He banged on the cockpit door asking to be let back in before passengers subdued him, said authorities.

Four passengers, including a retired NYPD sergeant jumped up and held the man down, Fox 5 reported.

“It was so scary,” said Lee. “People around me were freaking out a little bit. The girl next to me was saying, ‘Oh my god, what If I never talk to my fiancé again?’ ”

JetBlue Flight 191 — an Airbus A320 that can hold 150 people — made its emergency landing in Amarillo, Texas at 10:11 a.m. local time.

The flight had departed from JFK at 7:28 a.m.

Grainy YouTube footage purportedly taken by one passenger aboard the flight after its landing showed a scrum at the front of the plane as an attendant reminded them to stay seated and scolded people for taking video, saying, “We don’t need pictures of this, please.”

JetBlue said in a statement that the captain had a “medical situation” and was taken to an Amarillo hospital.

He was replaced on the flight deck by an off-duty captain who happened to be on the plane, the airline said.

Law enforcement sources told FOX News Channel that Osbon was taken to the nearby clinic under the care of the FBI, which is investigating the incident, and was receiving medical attention. The US attorney’s office in North Texas will decide whether charges will be filed.

Osbon’s distraught wife of six years, Connye Osbon, said she did not “have a clue” what had happened aboard the plane, in comments to ABC News.

“There are several different sides to every story. Just keep that in mind,” she cautioned, adding that she had not spoken to her husband since the incident.

In August 2010, JetBlue flight attendant Steven Slater gained national attention when he grabbed some beers, deployed his JetBlue plane’s emergency chute on the JFK tarmac and slid right off his job after an argument with a testy passenger.

‘I’ve had it! To the passenger who called me a motherf—-r, f–k you! . . . I’m done!” Slater bellowed into the plane intercom before taking the slide.

Two weeks ago, an American Airlines flight attendant had to be restrained after a “mental episode” where she began ranting over the public-speaker system that the plane was going to crash.