The winning ticket was purchased on January 6 at Reeds Ferry Market in Merrimack, near Nashua.
Temple found there was "no evidence" the New Hampshire State Lottery Commission was engaged in fraudulent activity, noting the drawing takes place in Florida.
In his 16-page resolution filed in Hillsborough Superior Court Southern District, Judge Charles Temple weighed the public's right to know with the unnamed woman's fears of "unreasonable intrusion" into her life and daily affairs.
Doe, Temple noted, had "met her burden of showing that her privacy interest in the nondisclosure of her name outweighs the public interest in the disclosure of her name".
This option was detailed on the lottery's website but not on the tickets and New Hampshire's lottery rules require the winner's name, town and the winning amount to be public.
"The Court therefore has no difficulty finding that [the woman] would also be subject to similar solicitation and harassment if her identity were disclosed", Temple wrote.
William Shaheen, a lawyer for the woman, had accepted a check for a lump sum of $352 million, about $264 million after taxes, reports said.More news: Glitch At Fertility Clinic Exposes Vulnerabilities In System For Women Freezing Eggs
More news: Infinity War Image Hints At MAJOR Change For Nick Fury
More news: Liverpool fans react to Jurgen Klopp's comments on Twitter
The woman signed her ticket after the drawing, but later learned from lawyers that she could have shielded her identity by writing the name of a trust.
Billy Shaheen, a lawyer for the New Hampshire victor, who was described in court papers only as Jane Doe, said that his client was elated to hear the news.
Release of winners' names provides transparency and assures the public that they aren't associated with the lottery, the office said.
The judge also rejected the lottery commission's argument that the woman's name should be revealed to assure the public she was a "bona fide" lottery participant and "real" victor.
Temple, who already agreed to let Doe collect her winnings through the Good Karma Family Trust of 2018 several weeks earlier, refused meanwhile to let Doe keep her hometown a secret.
Charlie McIntyre, the lottery commission's executive director, said in a statement: "While we were expecting a different outcome and believed the state had a strong argument, we respect the court's decision".
Maura McCann, a spokeswoman for the Lottery Commission, said in an e-mail that the state couldn't release Doe's hometown Monday, since "the ruling is not yet a final decision, still subject to final review and appeal".
Her lawyers said she intends to donate between $25m and $50m to charities during her lifetime.