NEW YORK (AP) _ Singer Bette Midler teamed with conservancy groups Wednesday to keep the city from auctioning off 115 city-owned lots that residents had transformed from trash-strewn eyesores into lush gardens.

Ms. Midler contributed $250,000 of her own money and got others to put up $4 million more to buy all the gardens, said Roberta Greene, a spokeswoman for the New York Restoration Project.

The lots had been slated for sale Thursday, before Ms. Midler, the New York Restoration Project and the Trust for Public Land stepped in. Ms. Midler started the New York Restoration Project in 1994.

``We're thrilled. This is a joyous occasion and means that these gardens will stay in perpetuity,'' Midler said in a statement. ``Today, I'm prouder than ever to be a New Yorker.''

The community gardens began springing up in New York about 25 years ago, when residents tired of the trash-strewn lots and illegal dumping grounds scattered around the city. They cleared out broken bottles and rusted-out cars, replacing them with pansies, petunias, collard greens and corn.

But Mayor Rudolph Giuliani decided that he wants the property back on the tax rolls and that the city shouldn't own so much land.

The gardeners first tried to prevent the auction, testifying at hearings and subjecting themselves to arrest at protests. One man dressed like a sunflower, climbed a tree outside City Hall and demanded a meeting with the mayor.

The gardens are as diverse as the gardeners, capturing neighborhood character. One in Queens was photographed recently for National Geographic; another in Harlem looks to yield vegetables this summer for meals at soup kitchens.

Telephone calls to city lawyers Wednesday were not immediately returned.