A bid to allow St. Mary's County to use the top floor of a library here to house prisoners from the county's crowded jail has been rejected by the town planning and zoning board after an outcry from town residents.

The 42-year-old county jail has become chronically crowded in recent years, largely as the result of stricter drunk-driving sentences, officials said.

County commisioners sought a special zoning exception that would allow them to incarcerate 26 prisoners -- those on work-release and first offenders convicted of nonviolent crimes -- in a dormitory on the second floor of the branch library. The library is located in a former National Guard Armory that was used as a state police barracks until last year.

But some residents said they were afraid that the inmates would not be closely enough supervised. They also told planning officials that a jail annex is not a proper use for a library on the fringe of the town's residential area.

But county officials said emergency relief was needed at the county detention center, which routinely holds 75 or more prisoners at a time, twice the number it was built to house in 1942.

The detention center is located next to the county courthouse in downtown Leonardtown, three miles from the library.

The county plans to complete a new jail in this town (pop. 9,500) in 1987. The facility is expected to accommodate 100 prisoners.

The detention center held on average 63 inmates a day last year, up from an average of 42 in 1983, jail director Albert F. Smith said. The all-time high, reached in Septemer, was 86 prisoners, he said.

On weekends, when the county prison population tends to peak, some inmates have been sent to the Charles County jail, 35 miles away.

St. Mary's officials contend that conditions at their detention center have already reached the critical point. They will appeal their case to the Leonardtown Zoning Appeals Board soon, said County Administrator Edward V. Cox.

"Fear was the driving force behind the citizens' objections" to the library proposal, Cox said. " . . .The rezoning was not discussed on the basis of fact. No questions were asked about how we planned to handle security."

The St. Mary's County jail, one of the oldest and most crowded in Eastern Maryland, has been criticized in several grand jury reports in recent years. In two upstairs cells, 14 prisoners share sleeping quarters meant for six; there is one toilet and one shower. Mattresses for 16 other inmates are rolled up and stashed under bunks during the day.

Inmates eat TV dinners three times a day in their cells because there is no cafeteria, according to jail officials.

A grand jury report last September described as "inhumane" the lack of air conditioning, while temperatures upstairs often soar above 120 degrees in summer.

The report cited the lack of an outside recreation area and the close proximity of female and male inmates as additional reasons for concern, and urged the county to apply for state funds to build another facility.

Last month the county received $150,000 in matching funds from the state to design a new jail. County budget director Joseph O' Dell said preliminary construction estimates range from $5.5 million to $6 million. Officials hope construction can start a year from now.

Cox said that throughout the controversy over the jail annex, residents' fears about use of the facility have been fueled by rumors about the work-release status of a man charged with the "particularly dramatic and brutal rape and murder" of a Chopticon High School teacher in her classroom last August.

Lester Broome, 19, the man charged in the slaying, was staying at a group home for juvenile offendors and working as a school custodian during the day, Cox said. "Unfortunately, he has been wrongly associated with the county work-release program . . . ," Cox said.

Smith said that only inmates whose conviction records show no prior crimes against persons will be recommended for the county work-release program.

"The typical inmate we want to put in the annex is the probation violator, the drunk-driving offender or the prisoner sentenced to serve several weekends in a row," he said. Smith said no locked cells will be built, but that a corrections officer will be on duty 24-hours-a-day to guard inmates in a dormitory setting.

Smith said he and county officials told library officials last week that if the plan is approved, a special security guard would be assigned to the library floor between 4 and 8 p.m. every evening the library is open.

"There will be no intermingling of library patrons and prisoners; they will have separate entrances and parking," Smith said.