SAN FRANCISCO -- In her own memory, Dianne Feinstein's nine-year reign as mayor of this booming city began with a moment of stomach-twisting horror -- former supervisor Dan White, having just murdered Mayor George Moscone, burst through a City Hall office door near where she stood and strode down the hall to the office of Supervisor Harvey Milk.

No one but White knew at that moment on Nov. 27, 1978, that he had just shot Moscone. Feinstein thought it odd that White walked right by her, refusing her request to stop and talk, but when she heard the shots from Milk's office and smelled the gunpowder, she began to realize what had happened.

Many of the worst moments of Feinstein's administration followed from that moment -- her emotional public announcement that both Moscone and Milk had been killed, her hasty election by the Board of Supervisors to a job she had so much wanted to win at the polls, the "White Night" riots by San Francisco gays after White was given a light sentence for murdering the openly gay supervisor and the mayor.

But the greatest difficulties of her long administration -- due to end in January -- and her most remarkable successes grew from a political shock just six months before she first took office -- the passage of a statewide initiative, Proposition 13, which cut deeply into the real estate tax revenues she and other California mayors depended on to make their cities run.

The simultaneous arrival of Feinstein and Proposition 13 "is nothing to brag about," she said in an interview, but it laid the cornerstone of what has become an unmistakable political success story -- the lasting image of Feinstein, the city's first female mayor, as a tough administrator willing to propose new taxes and fees and hold down expenses to keep the city prosperous and deficit-free.

Although critics contend that the city is heading toward red ink again and complain of poor mass transit and neglected residential areas, the signs of the 54-year-old Democrat's overall triumph are hard to miss:She turned a predicted $130 million deficit from Proposition 13 into nine years of new programs and balanced budgets funded by higher parking fees and bus fares as well as higher payroll, gross receipt and hotel taxes. She added 350 positions to the police force and saw the rate of major crimes drop 28 percent. She doubled housing production and moved more quickly than other mayors to fight the AIDS epidemic. She encouraged an active business climate that helped put San Francisco above other major cities in the ratio of business starts to business failures in the first half of 1987, according to Dun & Bradstreet Corp. In a San Francisco Chronicle poll, 49 percent of registered voters thought the city was better off since Feinstein took office, compared to only 23 percent who thought it worse off and 15 percent who rated it the same. The pollster, Mark Baldassare, called Feinstein one of the most popular politicians in the city's history.

Supervisor Bill Maher, who has sparred with Feinstein on several occasions, agrees. "The mayor has backbone, integrity and she works hard," he said. "The flip side of that is that she is sometimes dogmatic and rigid."

The political low point of her tenure -- a 1983 recall election inspired by gun-control opponents and fueled by some critics in the gay community -- disappeared in an 83 percent deluge of pro-Feinstein votes. She won 81 percent of the vote in the election for a second full term a few months later.

Feinstein will leave office soon. OnTuesday, three potential successors -- Assemblyman Art Agnos, Supervisor John Molinari and retired city chief administrative officer Roger Boas -- meet in a primary with several other lesser candidates. True to her moderate instincts, she has endorsed Molinari, considered more business-oriented and less liberal than Agnos, although not as conservative as Boas.

But that race, which will probably be resolved in a Dec. 8 runoff have little impact on Feinstein's future. She said she prefers administrating to legislating. A run for the U.S. Senate is out, but a spot on the 1990 gubernatorial ballot looks attractive. In the meantime, if a Democrat were elected president in 1988 and wanted her in his Cabinet, she would be unlikely to refuse.

Feinstein's characteristic approach to any crisis is taking a hard look at the administrator in charge of the policy in trouble. More than a dozen department heads and city commissioners have been fired or forced to resign during her administration. Police Chief Charles Gain resigned in 1979 after criticism of his handling of the White Night riots. Health Director Dr. Mervyn Silverman left in 1984 after clashing with Feinstein over slow action in closing the city's gay bathhouses.

The administrator who manages to survive the first few jolts of notoriety, or his or her successor, is summoned to a series of weekly meetings in the mayor's office. Those who cannot show progress from one week's meeting to the next rarely last long.

Feinstein said that when she leaves office she plans to travel -- particularly to China, which has become an important part of her vision of California as part of a Pacific rim community.

She said she will continue talking about cities and the need for imaginative solutions to the plight of places like San Francisco, now facing new state spending limits created by Paul Gann, one of the authors of Proposition 13. People who do nothing but hold the line against taxes do not, she argues, see the real world: "In 1982 and '83 the city spent $184,000 on AIDS. In '87-'88 we're spending $17.5 million. A few years ago there wasn't a program for the homeless, now it's $7.5 million.

"I think across the nation people have to come to grips with this: How can a country like ours be very proud when you have people sleeping next to ash cans?"