PHOENIX — Medical marijuana users have no constitutional right to grow their own drug, a trial judge has ruled.

Judge Katherine Cooper of Maricopa County Superior Court threw out a challenge by two men to a provision in the 2010 voter-approved Arizona Medical Marijuana Act that says only those living farther than 25 miles from a state-regulated dispensary can cultivate the plants.

She said there is no basis for their claim that the provision limits their health-care rights.

But Cooper left the door open for the men to raise a separate challenge that the 25-mile rule amounts to a violation of their rights under constitutional provisions guaranteeing everyone equal protection of the law. She said, though, they have yet to make a case for that claim.

The 2010 law allows those with a doctor’s recommendation to get a card from the state allowing them to obtain and possess up to 2½ ounces of marijuana every two weeks.

That law also envisioned a system of state-regulated dispensaries to sell the drug. But it also says anyone who lives farther than 25 miles from a dispensary could grow up to 12 plants at any one time.

Initially, that exemption applied to everyone because it took the state more than a year to license dispensaries. But state Health Director Will Humble said just about all of the approximately 40,000 medical-marijuana cardholders in Arizona now live close enough to a dispensary.

The challengers, who had been growing their own, did not want to give up that right.

They cited provisions of a 2012 constitutional amendment that says individuals cannot be forced to participate in any health-care system.

Attorney Michael Walz said forcing those who are entitled to use medical marijuana to buy their drugs at retail from a dispensary amounts to forcing them to participate in that system.

Cooper disagreed.

“Dispensaries are not a ‘health-care system,’ ” the judge wrote.

She said they do not manage, process, enroll or pay for health-care services for qualifying patients.

And Cooper said the amendment the men are relying on clearly applies to mandated health insurance, “not to a businesses that sell controlled substances.”

Anyway, the judge wrote, participating in the Arizona Medical Marijuana Act is hardly a compulsory program.

Instead, she pointed out, it simply allows those who qualify to legally obtain and possess marijuana.

“It does not compel people to use medical marijuana or even obtain a qualifying registry card,” Cooper said.

An appeal is likely.