Ryan Jeremy Knight, 39, has been sending Mayer and his team threats which referenced serial killer Ted Bundy and John Lennon’s murderer Mark David Chapman, according to legal documents filed in California.
He is alleged to have told the Grammy award-winning singer: “I’ve put many a Jew in the hospital.”
Mayer, 41, nearly came face-to-face with Knight when he was performing in North Carolina in June.
Security removed him from the venue.
The US star, whose hits include Gravity, Daughters and New Lights, has suffered “substantial emotional duress”, according to the documents.
A judge granted Mayer a temporary restraining order which means Mr Knight must stay at least 100ft (30m) away from the singer and his home.
A hearing will be held on 27 August to decide if the order should be permanent.
Mayer is currently on tour across America until the end of September and then in Europe.