A federal judge in New York tossed out a sweeping lawsuit Monday that sought to make marijuana legal under federal law, ruling that the plaintiffs had failed to take the necessary first step of asking the Drug Enforcement Administration to remove cannabis from its list of dangerous substances.

The ruling by the judge, Alvin K. Hellerstein of Federal District Court in Manhattan, was a stinging defeat for the plaintiffs — among them a former professional football player who owns a company that sells pot-based pain relievers, a 12-year-old girl who treats her chronic epilepsy with medical marijuana and a nonprofit group that works on behalf of minorities in the marijuana industry.

Though several courts have ruled in the past against similar litigation, the suit dismissed on Monday was passing through the courts as the Trump administration reversed an Obama-era policy and, in January, encouraged federal prosecutors to go after marijuana sellers, even in states that have legalized the drug, imperiling the viability of the country’s multibillion-dollar pot industry.

The suit, filed in July, employed some novel legal arguments, including a claim that the country’s marijuana laws have traditionally discriminated against minorities and have long precluded people who use pot for their illnesses from boarding airplanes, which are regulated by the federal government.