Amsterdam, whose scores of coffee shops are a major tourism drawcard, opposes the plan, and mayor Eberhard van der Laan says he wants to hammer out a compromise.
A lawyer for coffee shop owners said he would file an urgent appeal against the ruling by a judge at The Hague District court that clears the way for the introduction of the pass in southern provinces on May 1.
The pass will roll out in the rest of the country - including Amsterdam - next year. It will turn coffee shops into private clubs with membership open only to Dutch residents and limited to 2,000 per shop.
The changes are the most significant rollback in years to the traditional Dutch tolerance of marijuana use.
In a written ruling, the court agreed with government lawyer Eric Daalder that the fight against criminality linked to the drug trade justified the measure.
"This is a totally political judgment," said Maurice Veldman, one of the team of lawyers who represented coffee shop owners in the case. "The judge completely fails to answer the principal question: Can you discriminate against foreigners when there is no public order issue at stake?"
Veldman said he would appeal, but added it was unlikely he could do so before the new policy comes into force May 1.
The government argues that the move is justified as a way of cracking down on so-called "drug tourists," effectively couriers who drive over the border from neighboring Belgium and Germany to buy large amounts of marijuana and take it home to resell.
The tourists cause traffic and public order problems in towns and cities along the Dutch border.
However, such problems are virtually nonexistent in Amsterdam where the small, smoke-filled coffee shops are visited by thousands of tourists each year - mostly youngsters who consider smoking a joint to be part of the essential Amsterdam experience alongside visiting cultural highlights like the Van Gogh museum and the canals.
The conservative Dutch government introduced the new measures saying it wants to return shops back to what they were originally intended to be: small local stores selling to local people.
The government had no immediate reaction to Friday's ruling.
Coffee shop owners in the southern city of Maastricht have said they plan to disregard the new measures, forcing the government to prosecute one of them in a test case.
Though the weed pass policy was designed to resolve traffic problems facing southern cities, later studies have predicted that the result of the system would be a return to street dealing and an increase in petty crime - which was the reason for the introduction of the tolerance policy in the 1970s in the first place.
The cities of Tilburg, Breda and Maastricht have now said they oppose the pass system, though Eindhoven plans to move ahead with it and the eastern city of Dordrecht wants to adopt it in anticipation of an influx of foreign buyers - even though it is not yet required to do so.