SEATTLE — For the second time this month, a federal judge has rejected a challenge to Seattle’s first-in-the-nation law allowing drivers of ride-hailing companies such as Uber and Lyft to unionize over pay and working conditions.

U.S. District Judge Robert Lasnik late Thursday rejected a challenge brought by 11 drivers, saying that their claims against the law were premature or too speculative.

He earlier rejected a challenge brought by the U.S. Chamber of Commerce on behalf of the companies. The organization is appealing that decision. The National Right to Work Legal Defense Foundation, which represents the drivers, said Friday that it too would appeal.

But the judge declined to keep Seattle’s law on hold pending the appeals, clearing the way for the Teamsters to try to begin unionizing the drivers unless the 9th U.S. Circuit Court of Appeals says otherwise.

“The court recognized the public importance of maintaining and promoting the safety and reliability of the for-hire transportation industry in the City of Seattle, goals which this law advances,” Seattle City Attorney Pete Holmes said in a written statement Friday. “We are very pleased with the court’s decision and will continue to vigorously defend this publicly important law on appeal.”

The 2015 law requires companies that hire or contract with drivers of taxis, for-hire transportation companies and app-based services to bargain with them if a majority show they want to be represented.

The companies say a collective bargaining agreement could undermine the flexibility of how often and for how long drivers work — some of the things that make the companies attractive to drivers and passengers alike. But unionization supporters say it could help fix practices that have included unjust terminations and deceptive payment structures.

The drivers who sued to challenge the law argued that it conflicted with federal labor law as well as their right to free association. Lasnik disagreed, suggesting that any collective bargaining agreement could comport with labor law and the Constitution, and that their claims were thus premature.

“The ruling is very disappointing and means Uber and Lyft drivers will soon be targeted by Teamsters organizers with a coercive card check campaign seeking to impose one-size-fits all monopoly unionization, including forced union dues on drivers,” Patrick Semmens, vice president of the National Right to Work Legal Defense Foundation Vice President, said in a written statement.

Dawn Gearhart, a spokeswoman for Teamsters Local 117, said Seattle’s law “provides the only tangible vehicle for gig workers to have a voice in their working conditions.”

“We are looking forward to taking the next steps towards a meaningful resolution to the myriad of issues with the current practices of these companies,” Gearhart wrote in an email.