The court ruled against Marc Josemans, owner of the Easy Going coffee shop in Maastricht. Josemans challenged a penalty imposed in 2006 for violating a city ordinance that allows only Dutch residents to visit the cafes where marijuana can be openly consumed.
The court in a statement said the Maastricht ordinance complies with European law.
"That restriction is justified by the objective of combating drug tourism and the accompanying public nuisance, an objective which concerns both the maintenance of public order and the protection of the health of citizens at the level of the member states and at European Union level," the court said.
While marijuana is illegal in the Netherlands, the country has a long-standing policy of tolerance. That includes allowing it to be smoked in certain cafes.
Maastricht adopted its ordinance in 2005. In 2006, city authorities found Josemans guilty of allowing two non-residents into his cafe and imposed a temporary closing.