It is the northern California version of Dickens' "Bleak House," played out in a courtroom designed by Frank Lloyd Wright.

When she died at age 79 in 1975, Beryl H. Buck, the childless widow of the heir to a real estate and oil fortune, left most of her estate -- oil stocks worth about $10 million -- to serve the needy of Marin County, Calif., where hot tubs far outnumber homeless people.

At last count, the Leonard and Beryl Buck Foundation is worth $409 million -- yielding an annual income of some $30 million to be spent in the nation's second-wealthiest county of more than 50,000 residents. The San Francisco Foundation, which Buck left in charge of doling out the money, has been in court since February seeking permission to spend it elsewhere.

The San Francisco Foundation contends that Buck could not have foreseen the vast increase in her estate's value and that the restriction is senseless when other counties in the San Francisco Bay area struggle, with much less money, to serve many more needy people.

The county, Buck Foundation trustee John Elliott Cook and the state attorney general counter that the San Francisco Foundation is trying to sabotage the will, substituting itsld,10 vision for Buck's clearly stated views.

Cook was Buck's longtime attorney and neighbor and the author of her will. He and the county are trying to oust the San Francisco Foundation from its role administering what Marin residents call the "Buck bucks." The foundation denies the allegations of Cook's lawyer, Ronald Hayes Malone, that it "covertly connived to break the will and do away with the restriction even "before they got their hands on the money."

The issue in Estate of Beryl H. Buck, Deceased, currently being heard in architect Wright's distinctive Marin Civic Center a dozen miles north of the Golden Gate Bridge, comes down to the meaning of 36 words in Buck's will.

Buck, who moved to the county in 1935 with her husband, physician Leonard Buck, directed that the trust money "shall always be held and used for exclusively nonprofit charitable, religious or educational purposes in providing care for the needy in Marin County, California, and for other nonprofit charitable, religious or educational purposes in that county."

"There is probably no one living, other than lawyers, who could not understand exactly what these words say and mean," Marin County Counsel Douglas H. Maloney wrote in his brief to Judge Homer B. Thompson, brought in from Santa Clara County after the foundation complained that Marin judges could not be fair.

The bequest came from a fortune amassed by Buck's husband's father, Frank H. Buck, an itinerant land speculator who purchased some hill property and desert land near Los Angeles in the late 1800s. His hills became a large chunk of downtown Beverly Hills, and his desert turned out to contain rich oil reserves.

His daughter-in-law left 69,156 shares of stock in the oil company, Belridge Oil, in trust for the people of Marin. With oil prices soaring in 1979, Belridge was sold to Shell Oil Co. for $3,665 per share. That made Buck's bequest worth $253 million, and it has been multiplying ever since.

The money was freed later that year, after an initial round of legal wrangling over the will. The foundation has spent about $150 million in Marin, funding bicycle paths, a study of French intensive gardening, mobile animal shelters, energy-saving devices for private schools and more traditional charitable grants.

More than $100,000 has gone to encourage the development of high school sports, $800,000 to support the Marin Symphony and more than $6 million to buy and preserve 3,300 acres of vacant land in a county that is already two-thirds open space.

A high school theater group received $165,000; the Marin Education Foundation spent $57,000 in Buck funds one year by handing out $200 to every high school senior graduating in the top 10 percent of the class.

"It's overreplenishing the affluent," said San Francisco Foundation lawyer Michael J. Coffino. "The grants in Marin are so bloated as to be almost ludicrous."

In the past five years, Coffino noted, the San Francisco Foundation has spent more than $6 million to help the 1,500 residents of Marin City, where the county's poor are clustered. Of the county's 240,000 residents, 1 to 4 percent have incomes below the poverty level, according to official estimates; 930 families receive Aid to Families With Dependent Children, and 300 individuals receive general assistance.

*"When you look at it in terms of the pressing and desperate needs in the Bay Area, the money is really being wasted," said Anita P. Arriola, an attorney with Public Advocates, a San Francisco public interest law firm that has entered the case on the side of the San Francisco Foundation.

To change that situation, the foundation has invoked an ancient legal doctrine called cy-pres -- from the Norman French cy pres comme possible (as close as possible) -- that is used to modify a charitable bequest when circumstances make it impossible or impracticable to use it as the giver intended.

"To the extent she Buck knew what she was giving, that's her business," Coffino said. But, he said, "given the astronomical escalation" in the value of the trust, "we have to start asking the question 'What is wise?' " Judge Thompson, however, has made that argument more difficult to advance by barring evidence about needs outside the county.

The case "has to stand -- or fall -- on its own feet in Marin County," Thompson said. It "has nothing to do with how the money can be spent elsewhere."

Those opposed to sharing the wealth argue that Buck was well aware of the bequest's potential value and that it can be spent fruitfully in Marin, perhaps through a large project such as a major medical research center.

"Our view is you can't change people's wills on the basis of efficiency," said Marin lawyer Maloney.

The county began presenting its case this month. Witnesses described Buck's dedication to Marin and her particular vision of the needy, especially those whose comfortable lives have been disrupted by a major illness or other catastrophe.

"She always told me the government will take care of the poor and the wealthy can take themselves," Buck's nephew Leland Hamilton testified. "It's the middle class who need help."

The trial is expected to last into August. Marin residents, not surprisingly, appear solidly in favor of keeping the money where it is. Adam Morgan, an Iranian immigrant who operates Spotless Cleaners in San Anselmo, has collected nearly 30,000 signatures on a petition in support of the will and printed 6,000 "The Buck Stops Here" bumper stickers.

"She should be able to make her decision how to use the money," said Morgan, whose establishment sports a story-high mural, titled "The Top 10 Women of Miraculous Achievement," dedicated to Buck. "The principle of who is poor and who is rich is secondary."