Tiger Woods and Erica Sherman were frequently seen together during their relationship.
Erica Herman claimed the agreement was not valid due to a 2022 federal law that limits the enforceability of NDAs in cases of sexual harassment or abuse.
But the judge ruled that she provided no evidence of any sexual misconduct.
The case is part of a wider dispute between the pair related to a tenancy disagreement.
Ms Herman, a former manager at a restaurant owned by the golfer, is suing Mr Woods and the home trust he owns for $30m (£25m).
That suit alleges she was locked out of their shared home in Hobe Sound, Florida, after she was duped into packing her bags for a holiday.
She claims that Mr Woods had promised her that she could live at the home for 11 years. She is seeking payment for the cost to stay in a similar home in area for the six years.
Mr Woods has denied any tenancy agreement was made.
Wednesday's ruling means that the $30m case will now be heard in private out-of-court arbitration - out of the public eye.
Congress passed a law last year that bans NDAs that would prevent employees from speaking out about sexual harrassment or abuse. Lawyers for Ms Herman failed to provide evidence of any misconduct that would nullify the couple's NDA, the judge ruled.
Her 11-page ruling called the suggestion of sexual misconduct "vague and threadbare".
"Herman has had the opportunity to provide factual specificity for any claim relating to sexual assault or sexual harassment, however, she has not done so," wrote Judge Elizabeth Metzger in her ruling.
Earlier this month, lawyers for Mr Woods argued that Ms Herman's "case does not even attempt to assert a cause of action rising to the level of sexual harassment under any federal, tribal, or state law".
Ms Herman has said she cannot remember whether she signed the NDA in 2017.
The pair were first public as a couple in 2017. It is believed they ended their relationship sometime last year.
Ms Herman had been regularly seen with Mr Woods in the past six years, and was by his side in 2021 as he recovered from a severe car accident.
-- Courtesy of BBC News