An NYU psychology student was busted Monday for allegedly turning his dorm room into an air- rifle factory where he assembled and sold illegal pellet guns used in recreational war games, cops said.

Bernard Goal, 20, of Texas, was arrested in his Lafayette Street student residence after cops found six imitation Colt assault rifles strewn about his dorm room, law-enforcement sources said.

Goal was allegedly buying parts for the weapons online, assembling them, and then selling them online for up to $500 apiece.

Air rifles are illegal in the city, and laws also prohibit selling any imitation guns unless they’re clearly recognizable as toys.

A maintenance worker who entered the dorm room during a routine air-conditioner check spotted the guns on Goal’s bed and alerted campus security.

With Goal present, NYU guards found four more of the replica firearms and called the NYPD.

Police arrested Goal in his room on the 17th floor as his stunned fellow students looked on.

“It’s very scary to know there were guns one floor below me,” said a dorm resident who worked with Goal at the campus fitness center. “I had no idea.”

Still, she described Goal as pleasant and hardworking.

“It’s really shocking,” said dorm resident Nick Metcalfe, 20. “You’re part of a school. You can’t sit around and do crap like this. It’s a weird way to make a living.”

Pellet guns are used in a popular sport called Airsoft, in which contestants shoot each other with small plastic ammunition.

Goal refused to talk to investigators after his arrest, and asked to speak to an attorney.

He was hit with five counts of unlawful possession or sale of replica firearms — Class A misdemeanors that could carry up to a year in prison.

Goal was released last night on $2,000 bail.

“Bernard is a bright and hardworking college student,” his lawyer, Ramsey Hinkle, said last night. “If he had been outside New York City, or in his native Texas, this alleged conduct would not have violated any administrative code.”