A man was charged with a hate crime after allegedly assaulting a man in a Manhattan elevator Thursday in what police said was a racially motivated attack.

Devon Ahmad, 18, was riding in an elevator at 257 W. 39th St. on Thursday afternoon when he directed “anti-white remarks” toward the victim, according to Tiffany Phillips, an NYPD spokeswoman.

“He then proceeded to punch the victim in the face with a closed fist,” Phillips said.

The victim, whose name police did not disclose, was treated at a hospital for bruising and swelling around his right eye, Phillips said.

Ahmad had not posted bail of $15,000 cash or $25,000 bond as of Saturday afternoon, according to online court records.

Neither his attorney nor his family could be reached for comment. Ahmad was scheduled to return Wednesday to New York Criminal Court in Manhattan.