Safeway Stores Inc. filed suit to fend off a takeover attempt by Washington's Herbert H. Haft family, charging them yesterday with illegally manipulating the value of Safeway stock for personal gain.

In a lawsuit filed in U.S. District Court in Northern California, the world's largest grocery store chain accused the Hafts of "selectively tipping" professional stock traders about their purchases of Safeway stock last month in "an unlawful plan and scheme . . . to reap a quick profit."

The 25-page complaint says the Hafts' accumulation of nearly 6 percent of Safeway stock was not the first time the family had attempted to make a quick profit while pretending to buy a company. Safeway alleges that the Hafts, in at least three other instances, have bought a company's stock, inflated the stock's price by spreading rumors that a takeover was imminent and then cashed in for a large profit.

Responding to the suit, the Hafts -- founders of Dart Drug store chain, Trak Auto Corp. and Crown Books -- issued a one-sentence statement: "The lawsuit filed by Safeway is frivolous, totally without merit and will be vigorously contested."

The legal complaint represents Safeway's first salvo in what financial analysts predict will be a bitter fight if the Hafts do make a bid for the company, which had sales totaling $19.65 billion last year. Such suits often are used as a tactic by the targets of hostile takeovers.

The suit also accuses the Hafts of running the publicly held Dart, Trak Auto and Crown companies for their own self reward, citing their multimillion-dollar salaries and payments for building leases. "The pattern of self-dealing . . . demonstrates that the Haft family lacks the integrity to manage a major publicly held corporation like Safeway," the lawsuit said.

Safeway is asking the federal court to block the Hafts from making a bid for the company and to order the family to divest themselves of all Safeway stock.

Safeway Chief Financial Officer Harry D. Sunderland said that an official from the Securities and Exchange Commission had called the company to ask for a copy of the suit and for further discussion of the allegations. The SEC declined to confirm or deny whether there was an investigation under way. The Hafts also had no comment.

The lawsuit was prompted by the announcement last week that a partnership of two companies owned by the Hafts during the past month had purchased 3.6 million shares -- or 5.9 percent -- of Safeway stock for a total of $149.5 million.

At the time, the Hafts, in a document filed with the SEC, said they were buying the stock "with a view to the possibility of acquiring all of or a majority interest" in Safeway.

Safeway said it vigorously would contest any attempt by the Hafts and would strive to remain independent. Wall Street analysts have speculated that Safeway is weighing a host of financial transactions that could ward off the Hafts.

The use of a lawsuit to fight an unfriendly takeover "is an important offensive tool, but in the past it has not been very effective in blocking an aggressive accumulation" of stock, said one Wall Street lawyer, who declined to be named. Nonetheless, he noted, lawsuits such as Safeway's "help get the facts out and inflict pain on the aggressive shareholder to let him understand he is involved in a serious situation. It also buys time."

Yesterday, after a $2.68 per share run-up in the price of Safeway stock on Tuesday, the stock closed down $1 at $49.50 a share, with nearly a million shares traded.

According to the lawsuit, the Hafts are not serious about gaining control of the chain of 2,365 supermarkets. The Hafts' "true intention is to seek either to coerce Safeway to repurchase the Safeway stock acquired by them" at an inflated price or to put Safeway on the auction block "in order to reap a quick profit for themselves."

"In view of the huge disparity in size and resources between Dart and Safeway, they lack the financial capacity to effect such a transaction," Safeway noted. Safeway had 1985 sales of $19.65 billion and profits of $231.3 million. For Dart's latest fiscal year, which ended Jan. 31, the company had sales of $97.8 million and net income of $9.87 million.

The lawsuit noted that the Hafts bought their first stake in Safeway on May 15 when they purchased 3 million shares at an average price of $40.38 a share.

"Immediately following these ostensibly 'secret' purchases, rumors began circulating in the market that the Haft family and Dart had acquired a substantial stake in Safeway and were interested in acquiring the company. These rumors were the product of selective, intentional leaks to arbitrageurs professional stock traders and other market professionals by the Hafts or others acting at their direction or on their behalf," the lawsuit charged.

The result of these rumors, Safeway added, was a sharp run-up in the price of stock. By June 12 -- the day the Hafts publicly announced they held 6 percent of Safeway -- the stock was up nearly $8.

During the 20 days "in which the Hafts were fomenting rumors and trading in the market for Safeway stock, a total of over 7.8 million shares or approximately 15 percent of Safeway stock changed hands. By contrast, during the 20 trading-day period prior to May 15, approximately 3.8 million Safeway shares traded," the lawsuit said.

According to the suit, the Hafts engaged in similar conduct with their purchase of stock during the past 18 months in May Co. (parent of Hecht Co.), Jack Eckerd Corp., the nation's second-largest drugstore chain, and in Schering-Plough Corp., a drug manufacturer.

The lawsuit also alleged a pattern "of self-dealing" conducted by the Haft family in their role as chief executives of Dart, Trak Auto and Crown.

"The Haft family has abused its control of Dart, Trak Auto and Crown Books to enrich themselves at the expense of those companies and their public shareholders and have established a pattern of extensive self-dealing with those companies. For example, the Haft family has caused Dart and Trak Auto to lease extensive properties from private partnerships in which Haft family members, including Herbert's children Robert and Linda Haft, own all of the partnership interests."

According to documents filed by Dart with the SEC, Dart last year paid $2.3 million for leasing property owned by the Hafts.

"The Haft family has also caused Dart to enter into rich, 10-year employment contracts with Herbert, Robert and Herbert's wife Gloria Haft." For the fiscal year that ended Jan. 31, Herbert and Robert Haft each received cash compensation of more than $1 million from Dart and affiliates. In the previous year, Herbert received $5.5 million; Robert, $5.3 million.

Additionally, under stock option plans, Dart reported "$11.1 million as compensation expense attributable to Herbert and Robert Haft," the lawsuit said.

Safeway also accuses the Hafts of setting up a "sham" company to conduct its alleged stock manipulations. The Hafts told the SEC the stock acquisition was made by a new company, Garden Partnership, created specifically to buy Safeway stock. The partnership is made up of Dart (which owns 95 percent of Garden) and Combined Properties, which owns and operates the Hafts' real estate holdings, which include two dozen local shopping centers.

By creating a new company with no balance sheet and no assets other than stock in the target company, Dart is trying to evade the federal antitrust laws, Safeway contended. For if it were Dart, rather than Garden, making the bid, the company would have to file documents with federal antitrust authorities, who would bar Dart from completing any acquisition for at least 30 days until they had a chance to review the competitive aspects of any proposed takeover.