SANTA FE, N.M. -- A judge approved a final settlement Saturday for the disposition of the estate of the late artist Georgia O'Keeffe that includes formation of a foundation to distribute many of her paintings to museums, including the National Gallery of Art.

The settlement approved by District Judge Patricio Serna had been tentatively approved June 5 by O'Keeffe's longtime companion, John Bruce (Juan) Hamilton, and members of her family, who had been disputing the terms of O'Keeffe's will.

The estate was valued at $65 million.

"I think it's in the best interests of all parties, and certainly of Georgia O'Keeffe's estate, to not be tied up in years of litigation and extreme costs," Hamilton said after the three-hour hearing.

O'Keeffe died at the age of 98 on March 6, 1986.

The dispute involved the preeminent painter's will, executed in 1979, and two codicils, or amendments, in 1983 and 1984.

The 1984 codicil transferred the "residual" estate of 42 paintings worth about $47.2 million, or everything not specifically bequeathed to individuals or museums, to Hamilton. That codicil superseded the 1979 will, which had given the residual estate to charitable organizations for public display.

Under the settlement, those 42 paintings will go to the foundation. Hamilton will get 24 other paintings.

The artist's sister, Catherine Klenert of Milwaukee, and a niece, June O'Keeffe Sebring of Kailua, Hawaii, had contested the will and codicils, alleging O'Keeffe had been improperly influenced by Hamilton, 41, her companion and business adviser for 14 years.

The centerpiece of the settlement is the formation of the Georgia O'Keeffe Foundation, a nonprofit foundation that will distribute the 42 residual artworks to museums and other institutions, said Raymond Krueger, grandson of Mrs. Klenert, an attorney and heir in the estate.

Among other provisions in the settlement:

More than 36 paintings with an estimated value of $19.8 million will be given to the National Gallery of Art in Washington, D.C.; the Art Institute of Chicago; the Museum of Fine Arts in Boston; the Brooklyn Museum; the Cleveland Museum of Art; the Metropolitan Museum of Art and the Museum of Modern Art, both in New York City; and the Philadelphia Museum of Art.

Yale University will receive all letters, correspondence and clippings, to join similar materials from the estate of Alfred Stieglitz, O'Keeffe's husband of 22 years until his death in 1946.

The state of New Mexico will receive five paintings valued at $1.5 million to satisfy estate taxes.

The foundation received the artist's home at Abiquiu, and it will become the headquarters of the foundation.

Under the 1979 will and the 1983 codicil, which were affirmed by Serna, Hamilton gets about 10 percent of the estate, including the artist's Ghost Ranch near Abiquiu, and at least 24 paintings, with an unspecified value, as well as a photograph by Stieglitz, all of O'Keeffe's correspondence to him, certain copyrights, and works of other artists.

The Klenerts will receive five paintings and $295,000 in cash and Sebring will receive eight paintings and $489,600 in cash.

Sebring's lawyer, Jerry Wertheim, said his investigation found that when the 1984 codicil was signed, "Miss O'Keeffe was indeed weak. She was blind and deaf, basically. She was very frail and was having problems in mentation and remembering and those problems that are very common in a person who was very ill."

Jeffery Fornaciari, Hamilton's lawyer, said that if the case had gone to trial, Hamilton could have shown that "there are strong factual and legal bases for upholding all of Miss O'Keeffe's testamentary documents."

Hamilton said after the hearing that he has no ill feelings toward O'Keeffe's family.