Pressed closely together, the houses resemble worn packing crates. They have tin roofs and are connected by feeble wooden catwalks that cross ditches full of unmoving sewage. Here and there pigs lie in pens, ducklings scavenge through garbage mounds and children look for dry ground on which to play.

This is Bangkok's Rama IV slum, home for 780 families. Tucked behind shops and bank offices, it is one of an estimated 200 shantytowns where poor people live in squalor, shielded from the eyes of the fast-expanding city's more well-to-do.

To the Western visitor, the slum hardly seems a place to spawn loyalty. Yet for the past 13 years, in a fight called a landmark in community organizing in Thailand, its people have successfully blocked efforts to evict them and build a shopping and office complex on the site.

It is an issue familiar in many American cities: urban renewal opposed by the urban poor. "I don't know where we'd go," says a young woman whose family moved to the slum in the late 1950s. "We have a right to this place and we'll stay."

Slum dwellers say the marshy, 21-acre site was first settled some 80 years ago. Since then it has evolved into a self-contained community providing low-cost, if decrepit, housing for the poor. It is close to their jobs as laborers, mini-bus drivers and market vendors at Bangkok's Klong Toey port.

Walking through the slum's winding lanes, the visitor is astonished at the poverty, yet also at the depth of human activity. There are three weaving plants where girls operate looms, two Chinese temples (most of the slum's residents are ethnic Chinese), schools, three pigraising pens, gambling dens, three sugar-paste factories and shops that turn out fine rattan furniture.

Although households earn an average of only $210 per month, there is a smattering of wealth and education. Thus in one tiny house young men sit on the floor drinking cheap whiskey in the late morning hours, while not far away lives a courtly schoolmaster who forces a pot of tea on his visitors.

Until 1968, the slum dwellers paid rent to the land's owner, the Crown Property Bureau, the government agency that manages the extensive holdings of Thailand's deeply revered royal family. The year before, following repeated outbreaks of fire that leveled whole sections of the slum, the land was subleased to a real estate developer. The bureau ceased accepting rent from residents.

Slum representatives maintain that their leases were unfairly terminated years ahead of schedule and have asked for an investigation into alleged corruption in the transfer.

Company officials counter that they leased the land legally and have paid rent on it for 13 years. They say that because of unjust obstruction from community leaders, they have not gained possession of the site and put an end to a public eyesore and health hazard.

For 10 years, people in the slum resisted as individuals. Although a few acquiesced to pressure and moved, most found they could hang on by filing petitions or lawsuits that would take years to move through Thailand's sluggish judicial system.

But three years ago, the developer gained fulled lease to the land, and again eviction notices were tacked onto doors. Residents then formed a special committee -- with each of the slum's 13 lanes electing representatives -- to coordinate efforts against the developer and at the same time clean things up a bit.

Meeting monthly, or weekly if required, on Wednesday nights in a schoolhouse, the committee has organized teams to clear away the larger garbage piles and repair the wooden walkways.

The committee has renovated an old shed once used for illicit gambling and turned it into a pre-school for children with working parents.With the Thai equivalent of ABC posters in its freshly painted yellow classrooms, the school is one of the slum's few examples of order and cleanliness.

A credit union is another committee creation. With deposits of about $10,000, social workers say, it is now specializing in small personal loans to persons who would not qualify for bank credit.

Its other function is to represent the slum in dealings with the developer. Slum leaders hope that the committee eventually will wrestle the land's lease away, and then finance a cooperative program to rebuild the houses, fill the ditches and make Rama IV a fit place to inhabit.

Cooperative efforts like these, social workers say, are the exception in the slums of Thailand. They have come about despite deeply rooted traditions of individualism and superior-inferior social relationships, which nonetheless continue to leave their mark on the slum's strategy.

Community leaders say that the slum is fully mobilized and united yet, in fact, only a minority of residents are actively involved in the fight. The committee has only about 57 members. A well-attended community meeting might draw 300 of the slum's nearly 4,000 persons.

Many committee members are what anthropologists call informal leaders, people who through physical strength, loquacity or underworld connections are listened to in their community.

As often happens in a Thai village, people with a grievance have turned to their wealthiest and most highly educated neighbor for guidance. She is a gynecologist named Somphorn Surarit, whose family owns a three-story clinic on the slum's edge and, like everyone else, stands to be evicted.

The petite Dr. Somphorn has followed a similar strategy, appealing for the intercession of persons farther up the social hierarchy. She has organized repeated demonstrations and petitions directed at prime ministers, Cabinet officials and even the royal family. Earlier this year, she personally handed a petition to Princess Sirinthorn, daughter of King Bhumibol Adulyadej.

When "the doctor," as she is respectfully known (only one household head in five has more than a fourth-grade education), walks through the community, people unconsciously defer to her, asking advice or giving excuses why they didn't make it to the last meeting or rally.

Her role as community leader has led her to all but abandon her medical practice. What worries her now are reports she says she got from underworld figures within the slum that a gunman has been given $2,000 and a weapon to kill her if she does not clear out.

True or not, the report is believed by many people in the slum, who consider arson and murder par for the course when a slum is to be cleared. "Don't run away upcountry," counsels the slum's schoolmaster. "There's even less protection there. Stay here where it's safer."

In mid-October, when the reports first surfaced, the committee organized about 300 persons for yet another demonstration before the prime minister's office and the Crown Property Bureau. Now they are awaiting a response.

Having held out for 13 years already, Rama IV's residents seem to have a fair chance to eventually carry the day. By making noise, they have made government agencies wary of finishing the job, lest they be branded villains by newspapers and members of Parliament.

Their campaign also may have helped alter official thinking toward low-cost housing in Bangkok. If there is no land-tenure problem, government planners now argue, it is better to improve the traditional neighborhoods than to erect costly new public apartments.