Dylan Lopez Contreras, 20, was seeking asylum from his native Venezuela, which the judge denied.
His attorneys plan to appeal the decision.
"The court's decision to again further deprive Dylan of his basic rights to a fair hearing, due process and justice is outrageous and beyond heartbreaking - not only to Dylan and his family, but to his schoolmates, friends, teachers, neighbors and the many hundreds of community members, advocates and New Yorkers who have rallied around him to demand his immediate return home," Lauren Kostes, supervising attorney for NYLAG's Immigrant Protection Unit, said in a statement.
Contreras's attorneys say he was wrongfully detained, was in the U.S. legally, and never missed a court hearing.
He was taken into custody by ICE agents outside a scheduled immigration hearing back in May, according to the New York Legal Assistance Group.
Contreras was attending a Bronx high school that caters to older newcomers.
His detention sparked demonstrations, including at the steps of the city's education department in Lower Manhattan, where demonstrators rallied and demanded Contreras's release.
----------
* Get Eyewitness News Delivered
* More New York City news
* Send us a news tip
* Download the abc7NY app for breaking news alerts
* Follow us on YouTube