The last time Illinois built a prison, no town wanted it. But when the state announced plans for a new 750-bed medium security facility last year, more than 20 Illinois towns exploded with enthusiasm.

The citizens of Marshall even painted "Welcome Mr. Lane" on the high school football field in huge, fluorescent orange letters when the state's director of corrections paid a visit.

Like a prison, a mammoth slaughtering plant exuding the odors of 16,000 hogs a day lends little enchantment to any town. But Stanwood, Iowa, and Sheffield, Ill., are fighting tax break for tax break, environmental concession for concession, to get those butchered hogs into their city limits.

Throughout the economically devastated Midwest, with factories crippled by foreign competition and farmers chilled by recession, communities are grasping for unlikely saviors--prisons, chemical plants, rendering yards--anything to keep tax dollars and children from migrating to the Sun Belt.

With some of the nation's highest unemployment rates, Midwesterners are suffering not only in big cities like Detroit, but also in little towns like Marshall, population 3,500.

Here, small components of the auto industry like the Stanadyne/Supermet plant, a beige brick-and-metal building where rear view mirror brackets and air conditioning parts are made, has laid off about 10 of 70 workers and helped push the town's unemployment rate to 16 percent.

Pete Kelley, 37, has been out of work since July. The little plastics factory where he worked closed, leaving him to live on the $10,000 a year from his wife's work as an accountant and odd electrical jobs he has been able to find. He hopes the prison will come soon, which would mean $35 million to $50 million in construction work followed by a $9 million annual payroll for at least 400 local people expected to be hired.

Freckled and sandy haired, Kelley now babysits his son Eric, 9 months, and thinks about the good job he used to have at a prison in Indiana. "The last couple years have been real bad," he said. "The prison would help." Mayor Ted Trefz, 60, a solid man arriving at his office in casual clothes and baseball cap decorated with his feed company's logotype, has been to the state capitol at Springfield twice to lobby for the prison.

Marshall has intense competition from 21 other Illinois locations, such as Brown County, which last week sent a 100-car "caravan to the capital" to impress Gov. James R. Thompson, who must make the decision. The county has offered an 80-acre site--worth $150,000 or one-third of the annual county budget--for free.

Half the county's 5,000 residents turned up at a public hearing to support the project and on Valentine's Day Thompson and Department of Corrections Director Michael Lane each received a dozen red roses and a poem:

When you make your decision

On a medium security prison,

You'll find not a frown

In the County of Brown.

"In 1977, when we had to locate a couple of new prisons, we had to go around hat in hand and cajole people into letting us even talk to them," said Nic Howell, public information officer for the corrections department.

The reason for the change of attitude, he said, "is the economy." Only two of the 22 communities competing for the facility have unemployment rates below 10 percent, "and most are in the 16- to 20-percent range," Howell said. In Stanwood, Iowa, the unemployment rate is at least 16 percent, according to the calculations of mayor and carpenter Mike Rouse and his artist-insurance agent wife Karen, who know every one of the 700 town residents.

"I do not want it to end up like a ghost town," said Karen Rouse, explaining the effort they have put into attracting a huge and potentially smelly pork processing plant.

Already 17 houses are for sale in the little community with no buyers in sight. Without the plant, she said, "The town is going to dry up and all we are going to have is retired people."

One of the young people the Rouses worry about is Donald Doser, 27, who was laid off as a painter at the Harnischfeger crane plant in Cedar Rapids a month ago. Doser's wife, Lynn, lost her job a year ago in cutbacks at a small factory eight miles from Stanwood.

The plant, which makes battery chargers and automobile parts, is one of hundreds of little automobile-related factories scattered through the Midwest feeling the auto industry chill.

In October, Doser's unemployment benefits will run out and it will be time to think of packing up 2-year-old son Anthony and moving elsewhere. "I have been to Cedar Rapids looking for other work, but the situation is futile; it really isn't worth it," he said.

Similar to Marshall, Stanwood sits just off the main thoroughfare like a small patch of history on the flat, rich farmland. It has short streets with big, two-story gabled houses on acre plots, large trees and small shops, gas stations and little factories slipped in here and there.

Many people engage in some part-time work. Karen Rouse has painted soft-colored Iowa woodland scenes on her living room walls and sells some paintings at fairs. Doser occasionally finds a farm equipment repair job.

But each family needs at least one steady source of employment, so many have depended on jobs at factories in nearby cities (Stanwood is 30 miles from Cedar Rapids and Marshall is 15 miles from Terre Haute, Ind.) where layoffs have become rife.

The hog processing plant, which would be the country's largest, would provide 600 new jobs, not counting construction work for the multimillion-dollar facility. Iowa Beef Processors Inc. of Dakota City, Neb.--a subsidiary of Occidental Petroleum--has narrowed the search to Stanwood and Sheffield, Ill.

Iowa has arranged a big tax break on Stanwood's behalf, as has Illinois for Sheffield, and the Iowa legislature is moving to ease environmental restrictions on treatment of water for the facility, which the company says would consume 3.5 million gallons a day.

A few local farmers, backed by environmentalists, have gone to the state capitol to oppose these concessions. Many Stanwood merchants think such opposition is suicidal.

Deborah Butler, 30, mother of two children and owner of the Hi-Way Gardens roadside bar, said if the town's economy does not improve soon, "I don't think I can stay in business." The beauty shop owner also is in trouble. "She hasn't paid her water bill in a year," said Rouse, the frugal mayor. "She's working on it," said his wife, the loyal customer.

The Rouses have three tall, handsome sons--Todd, 19; Tim, 16, and Tyler, 13-- the central reason why they and parents in hundreds of other small towns throughout the Midwest are fighting for projects that would increase the number of jobs close to home.

In Marshall, city meter reader Jim Phillips' 19-year-old son, Jimmy, was laid off at Stanadyne/Supermet and left for Houston where he quickly found construction work.

According to Phillips, Jimmy "was tickled to death" but Phillips' wife, Patricia, was not. "She's down there right now, seeing how he is," Phillips said.

In Kankakee, Ill., a much larger community with 102,000 people and a well established industrial base, the unemployment rate is just as high--16.3 percent--and the determination to do something about it just as fierce as it is in Marshall.

Roper Corp., the stove manufacturer that had been the county's largest employer, has laid off 680 workers and is scheduled to let go 600 more.

In response to that threat to Roper and other large factories that depend on the crippled housing and automobile markets, banker and Chamber of Commerce Board Chairman Donald V. McCann and Chamber of Commerce President Les L. Horrell Jr. are trying to interview every major employer in the county and, with the help of local officials, tend to their slightest need.

"If they need a stoplight to make the traffic flow smoother, we get them a stoplight," Horrell said.

They also aggressively have promoted Kankakee, 50 miles south of Chicago, throughout the state and the world. A 13-minute videotape on the city's advantages, kicked off with the brief mention of Kankakee in the Arlo Guthrie song "City of New Orleans," has been sent to dozens of companies and copies have been dubbed in Japanese and German.

Their efforts have paid off.

General Foods created more jobs by consolidating its coupon redemption center in the county, Connecticut General opened new offices in the county town of Bourbonnais and Kroger Corp. is opening a new supermarket in an abandoned Montgomery Ward building, creating 114 new jobs.

Some Japanese officials, entranced by the videotape, landed their helicopter on the sixth hole of the Kankakee country club recently and got in some golf and a good look around.

Other Midwest cities are pursuing businesses unwelcome elsewhere. Austin, Minn., issued $350,000 in tax exempt bonds to entice Northwest By-Products Inc. to move its animal by-products processing plant into town after a court ordered it moved out of Mason City, Iowa, because of complaints about foul odors and truck traffic noise.

But in some places, the protests about unpopular projects have stymied even the most energetic city promoters.

Public outcry over a proposal for a new hazardous waste treatment plant in Kankakee led the Chamber of Commerce to wash its hands of efforts to promote the idea. In Stanwood, energetic lobbying by a few farm families persuaded the state House of Representatives to restore protections against large quantities of sulfur in water discharged by the hoped for pork-processing plant.

"Our biggest gripe is how one company can come into Iowa and try to change our laws," said Tom Fagan, one of the protesting Stanwood farmers. "Why can't they come into the community clean?"

Donald Doser supports the plant because it would improve the job situation and perhaps make it unnecessary for him to move to Oklahoma City, where he could get an oil field job but has mixed feelings about working with flammable materials 150 feet up in the air. But, he cautions, if the plant comes in, "I don't want to give up the environmental protections."

In Marshall, only a few people--Mayor Trefz says he can name all three--turned out at the public hearing to oppose the new prison.

But some may have stayed away thinking any opposition is futile. Georgia Rease, an older woman who owns the East Marshall Motel, explains this attitude as a discomfort with any change in what has been a pleasant existence.

"Marshall won't ever set the world on fire, but it does have one thing going for it. It is a nice place to live," she said. "A lot of people who have lived here a long time aren't too crazy about the prison."