T.J. Miller, pictured at the July premiere of “The Emoji Movie,” has been charged with calling in a false bomb threat. (Mario Anzuoni/Reuters)

A little over three weeks ago, T.J. Miller allegedly called 911 to report that a woman on his Amtrak train from Washington, D.C., to New York had a bomb in her bag. Amtrak investigators stopped a train in Westport, Conn., where passengers were told to evacuate so that a bomb squad could search the cars.

There were no detected explosive devices on board, and law enforcement claims the actor knew this to be true when he contacted them.

Miller was charged Tuesday with intentionally calling in a fake bomb threat, according to a news release from the U.S. attorney for the District of Connecticut. He was arrested Monday night at LaGuardia Airport and appeared before a New Haven judge the next day. Released on a $100,000 bond, he could face a maximum of five years in prison.

The federal complaint states that Miller told a 911 dispatcher March 18 of a female passenger on Amtrak Train 2256 who kept checking her black carry-on and asking an attendant for the name of the next stop. The dispatcher, who sensed slurring, asked Miller if he had consumed alcohol that day, to which the actor allegedly admitted he had had a glass of red wine.

Amtrak investigators did not find a bomb after they stopped Train 2256 in Westport, according to the news release, and they realized Miller had been traveling on Train 2258. The correct train was eventually stopped and inspected, and an attendant told investigators that Miller had seemed intoxicated when he boarded in Washington, and that he had been removed in New York after drunkenly arguing with a female passenger in the same first-class car.

Per the release, that woman was not carrying any explosives and was seated out of Miller’s direct line of sight. The complaint alleges that the 911 call was “motivated by a grudge.”

Miller made headlines a year ago when HBO announced in May that he would be written out of “Silicon Valley” after four seasons. The next month, he told the Hollywood Reporter that he had walked away from the show after producers offered him a decreased role in the fifth season.

In December, the Daily Beast published a woman’s allegations of Miller sexually assaulting her while they both attended George Washington University. The actor, in a joint statement with wife, Kate Gorney, called the claims “false accusations.”

The Amtrak incident is being investigated by the FBI’s Joint Terrorism Task Force, Connecticut State Police, Metropolitan Transportation Authority Police Department, Amtrak Police Department and Westport Police Department. Miller’s legal representatives did not respond to The Post’s request for comment.

Read more:

T.J. Miller trashed his movie, his boss and much of Hollywood. How often does this happen?

Terrific ‘Barry’ shows how HBO’s best dramas are often found in its comedies

‘The Emoji Movie’ has a zero score on Rotten Tomatoes. Here’s how critics are eviscerating the film.