Gardner, 36, filed the request last week against Gina Devasahayam and said in court documents that she has "harassed and menaced" him and his family, the New York Post reported.
Bronx Supreme Court Justice Eddie McShan said he granted the request Monday because of "the possibility of injury."
Gardner has told the court that Devasahayam believes they have some sort of relationship, but he said they have never met in person.
Devasahayam, 46, told the Post outside the courtroom that they met on social media.
The judge gave Devasahayam until Thursday to offer evidence to alter the ruling.