A passenger died on a Nigeria-to-JFK flight after a vomiting fit Thursday — and a top lawmaker said officials gave the corpse only a “cursory” exam before declaring that the victim did not have Ebola.

Rep. Peter King said in a letter to Homeland Security and Customs and Border Protection that the handling of the remains exposed serious flaws in airport preparedness for an Ebola outbreak.

Between 70 and 100 passengers a day arrive at JFK from the Ebola epicenter countries of Liberia, Sierra Leone and Guinea, King noted, and they have access to public restrooms and mingle with other travelers before their first screening.

“Given the high volume of travelers at JFK, it is essential that extraordinary measures are taken to intercept possible Ebola-infected passengers,” while keeping the public and first responders safe, King (R-LI) wrote to Homeland Security Secretary Jeh Johnson and Customs Commissioner Gil Kerlikowske.

“These individuals transit the airport with the rest of the traveling population, including using the restrooms,” King wrote.

“It is only after they arrive at the Customs and Border Protection primary screening location that they are separated and sent to secondary inspection for a medical check and to complete the questionnaire,” he wrote Johnson.

His letter demands Homeland Security immediately beef up protocols for potentially infected passengers both in flight and at the terminal itself, prior to their reaching the screening location.

The letter also demands better training and safety equipment for the Port Authority police and Customs and Border Protection officials who can come into contact with high-risk passengers.

The unnamed passenger, age 63, had boarded an Arik Air plane Wednesday night out of Lagos, Nigeria, which has had 19 Ebola cases this year though no new cases in the past month.

Rep. Peter T. King letter to Department of Homeland Security and U.S. Customs and Border Protection

He was vomiting in his seat and died sometime before the plane landed around 6 a.m., the source said. The crew contacted the CDC, whose officials boarded the plane as about 145 worried passengers remained on board, a federal law enforcement source said.

“The door [to the terminal] was left open, which a lot of the first responders found alarming,” said the source.

“The CDC went on the plane, examined the dead body and said the person did not have Ebola,” King told The Post. “It was, what I was told, a cursory examination. The Port Authority cops and personnel from Customs and Border Protection were there . . . Their concern was, how could you tell so quickly? And what adds to the concern is how wrong the CDC has been over the past few weeks.”

The CDC declined to comment on the passenger.

Additional reporting by Lorena Mongelli