Williams' attorney, Peter Ginsberg, said Williams would appeal, with training camp right around the corner.
"It's a huge blow to him. It's very upsetting," Ginsberg said.
Williams contended the league violated protocol in collecting urine samples from him in August. U.S. District Judge Christine Arguello dismissed the complaint.
Williams and former Broncos defensive lineman Ryan McBean sued the NFL in March after the league suspended them without pay for the first six games of the 2012 season.
The NFL alleged that urine samples the players provided to an NFL specimen collector for testing last August weren't from a human.
Ginsberg argued that the specimen collector watched Williams void directly into the specimen bottle.
The players said the league violated protocol in collecting the samples and refused to clear the players, even after the collector was fired.
McBean has since dropped out of the case and is now with the Baltimore Ravens.
Williams, Denver's leading tackler in four of the last five seasons, also faces trial on a drunken driving charge in August.
Copyright 2012 by The Associated Press