A Bronx man tried to run off and join the Taliban in Afghanistan so he could kill US soldiers there — but was captured in a Big Apple airport moments before boarding a plane, federal law enforcement officials announced.

The FBI arrested Delowar Mohammed Hossain, 33, at 10:30 a.m. Friday, as a tried to board a plane at John F. Kennedy International Airport to fly overseas to join the terrorist faction.

He was charged with one count of attempting to provide material support for terrorism.

“You know what I want to do, seriously, I just want to take a frickin’ machine gun and just shoot everybody and kill ’em all….this is all you want to do, OK, go to hellfire. Die you frickin’ scumbags,” Hossain told an informant about US soldiers, according to court papers.

Hossain had been under investigation since the fall of 2018.

“Hossain wanted to kill Americans, and particularly wanted to target members of our armed forces, serving our nation overseas,” said Manhattan US Attorney Geoffrey S. Berman, praising the efforts of the FBI and the NYPD, which worked together as part of the Joint Terrorism Task Force.

“Hossain planned to travel overseas and join the Taliban in order to kill American soldiers,” said Assistant Attorney General for National Security Demers.

He tried to recruit a fellow would-be jihadist as a traveling companion, but the pal was actually an FBI confidential informant, officials said.

Hossain planned to fly to Thailand and then Pakistan, where they would cross the border by land into Afghanistan, officials said.

He had already equipped himself with walkie-talkies and trekking gear — and had told the informant to save money “to buy weapons” with once in Afghanistan, officials said.

Hossain was shackled at the ankles and still wearing his traveling clothes — a white Guess T-shirt and blue jeans — as Magistrate Judge Stewart Aaron ordered him held without bail Manhattan federal court Friday.