FRESNO, Calif. (AP) _ It seemed natural in the 1870s for towns to develop along the new Southern Pacific Railroad line running down the San Joaquin Valley, the heart of California.

The fledgling communities were needed to serve farmers and the railroad that took their crops to market. The valley was 200 miles long, so using a little prime land for houses and stores didn't seem too threatening.

But in the 1990s, little farm towns have grown into big cities spreading steadily into farmland that produces $11 billion worth of crops a year in the eight valley counties.

''Most of our towns were developed on prime land, so as they expand, they're eating up our best land,'' says Leslie Hopper, an associate planner for Stanislaus County.

''Now, cities are threatening the economic base they were set up to serve,'' adds John Gamper of the California Farm Bureau. ''It's not only the acreage that's being lost, but the quality of land and location of the land.''

The eight counties grew 34 percent to 2.7 million residents during the 1980s. The state predicts an additional 800,000 people will live in the valley by the year 2000, and experts say the population could double within two decades.

''This agricultural bounty is at risk because the valley has another crop - cookie cutter subdivisions and shopping malls,'' warns Gregory Carnill, western director of American Farmland Trust. ''As costs squeeze homeowners out of metropolitan areas, the valley becomes a sponge to soak them up.''

High housing costs have deadened the lure of California's coast. Many are willing to commute up to 100 miles from the San Francisco Bay Area to the northern valley or from Los Angeles to Bakersfield in the southern valley to escape the high-priced coast.

Ted Bradshaw, a researcher at the University of California, Berkeley, envisions the valley becoming the state's center of population growth.

''There's virtually nothing to stop the urban growth,'' Bradshaw said. ''It's all flat and it's all developable. The population is really going to go wild. ... The question is where is it going to go?''

The growth has brought noticeable changes. Water quality in the larger cities has worsened, and smog has the potential to be as bad as it is in Los Angeles.

Crime exploded in the 1980s with drug busts, gang drive-by shootings and graffiti becoming common throughout the region. Fresno recorded a 73 percent increase in reported violent crimes, burglaries and auto theft between 1981-90. Stockton, Bakersfield and Modesto - the valley's three other major cities - also saw crime grow.

Several methods are being tried or proposed to control growth better.

The Legislature is considering a bill to require economic impact reports for farmland conversions above a minimum acreage, which would be set by each county. Another would require counties to prepare plans to preserve prime farm land.

Some local governments aren't waiting for the state to act.

Stanislaus County is considering a plan Hopper says would ''accommodate growth while protecting our best agricultural areas.''

Signatures also are being sought for a tougher initiative that may go on the November ballot in Stanislaus. It basically says there will be no development for 20 years on rural land that gets water from irrigation districts, says a supporter, Sierra foothills grower Larry Hooker.

Merced County already requires an environmental review before developers can split land into lots smaller than 20 acres in areas zoned agriculture.

Tulare County has a rating system that determines whether land is preserved as agricultural or can be developed.

''It has discouraged frivolous or premature development applications,'' says Shirley Kirkpatrick, a Tulare planning commissioner and farm activist.

But Kirkpatrick still worries that ''dollars may soon start talking louder than good government.''