Walgreen Co. is suing the city of San Francisco over legislation that would ban the sale of tobacco products in pharmacies, but city officials said yesterday the drugstore chain faces an uphill battle in striking down the new law. The lawsuit, filed in state court in San Francisco Monday, argues the ordinance is illegal because it targets drugstores while ignoring other retailers that have pharmacies and sell tobacco products, including some grocery stores. The lawsuit seeks to have the ordinance declared unconstitutional and prevent the city from enforcing it. "The basis for this is that as consumers we rely on stores like Walgreens to provide for health care needs, not to enable deadly habits," said Matt Dorsey, a spokesman for City Attorney Dennis Herrera. A hearing is set for Sept. 30, a day before the ordinance goes into place. WAG (NYSE) rose 52 cents to $35.75.