The man allegedly claimed to have traveled to the US on five occasions to try to meet the star.
The temporary restraining order was granted by a Los Angeles judge against Jean Christophe Prudhon, 51, from Dijon, France, who has allegedly sent the actress at least 50 love letters in the past four years.
In legal documents, Ms Dunst’s mother Inez states: “Mr Prudhon suddenly escalated his harassment of my daughter by coming directly to the door of the home that both I and my daughter live in and asking to speak with her.
“I am extremely fearful of him because he is clearly mentally ill. After Mr Prudhon left, I found that he had written a new letter for my daughter and had left it at the house. This letter, dated November 30, 2011, discusses his long obsession with my daughter.”
The restraining order is in place until a hearing on December 21, when a judge will decide whether to make the order permanent.