U.S. District Judge Phyllis J. Hamilton in Oakland, Calif. handed down the decision on Monday.
The case stems from the Food Safety and Modernization Act passed by Congress in 2011. The act created a sweeping set of rules that will allow the FDA to order recalls and make it easier to trace contaminated food.
Congress mandated the FDA enact the new rules within 18 months.
Two nonprofits, the Center for Food Safety and Center for Environmental Health, alleged the agency failed to meet the deadlines and sued in 2012.
FDA spokeswoman Shelly Burgess said she could not comment on pending litigation.