Mayor Marion Barry may be facing the toughest political decision of his second term: where to build a federally financed prison in the District.

Regardless of the type or size of facility city and federal authorities decide to build, a new prison almost certainly will be unwanted by the community chosen as the site.

Barry got a taste of things to come last weekend when residents and politicians from the Congress Heights area angrily reacted to a published report that officials were considering a seven-acre parcel in their area as the site for the new prison.

The mayor was obliged to take time in his third annual state of the District speech on Monday to assure residents that he is "unalterably opposed" to using that site.

Later, when asked by a reporter what he would do if federal authorities insist on using that site for a prison, the mayor responded, "We'll have to cross that bridge when we come to it."

For years, the District has been able to export many of its prison problems to other jurisdictions.

Lorton Reformatory, the city's main correctional facility designed to hold about 3,500 inmates, is located out of sight in southern Fairfax County. Since taking office in 1979, Barry has added 1,887 beds at the Lorton complex to deal with the mounting population. The city has shipped off an additional 1,500 convicted felons to federal prisons throughout the country.

As the overcrowding problem intensified, the D.C. Deparment of Corrections relied more and more on the D.C. Jail, near the Robert F. Kennedy Memorial Stadium, to handle the overflow of convicted misdemeanants from Lorton. The jail was built to hold persons awaiting trial, not convicts, but the city had no choice but to use part of the jail as a prison.

Today, the city simply has run out of space and needs to substantially enlarge its prison facilities.

Barry was a late convert to the push to build a new prison in the District. He finally relented this month in the face of a bulging D.C. prison population, public clamoring for tougher treatment of criminals and mounting pressure from Capitol Hill and the Justice Department.

With northern Virginia officials already up in arms about the security problems that Lorton presents for surrounding Fairfax County residents, the idea of building another major facility within the Lorton complex is politically unfeasible. If Sens. John Warner and Paul Trible (both R-Va.) had their way, Lorton would be closed down and the prisoners shipped back to the District. But that is not likely to happen in the foreseeable future.

Instead, Barry has climbed aboard a bandwagon driven by Sen. Arlen Specter (R-Pa.), chairman of the D.C. Appropriations subcommittee and U.S. Attorney Joseph E. diGenova, who have argued for months that the solution to the city's nagging corrections problems is the construction of a new prison on federal land in the District.

Barry used to argue that the city's prison population would gradually decline and that there are more sensible and less costly ways of dealing with all but the most dangerous of criminals. He had in mind work release programs, halfway houses, prisoners diversion programs and other schemes for keeping convicted criminals out of prision.

In justifying his 180-degree turnabout, Barry said he had underestimated the impact of increased arrests, tougher sentencing and new rules for revoking parole and probation on the prison population.

"Until the surge of the past two months in inmate populations, we thought our facilities would be adequate," Barry said in his State of the District address. "I now believe that we need additional facilities. I am willing to support the construction of a new prison facility in the District on federal land paid for by federal dollars."

By embracing the idea of a new prison, the mayor also has committed the District government to paying the cost of operating the facility once it is completed. The D.C. Coalition for Justice, which opposes prison construction, estimates the District government would spend $22.5 million in operating costs during the first three years of a new prison's operation, assuming construction of a 500-unit facility.

Apart from the long-term budgetary consequences, Barry, who is up for reelection next year, faces a more immediate political dilemma. How do you plop a new prison somewhere in the District (with a land mass of only 61 square miles) without alienating a large segment of voters?

In his speech this week, the mayor declared that none of the city's eight wards has been ruled out as a site for a prison, but the mayor wasn't fooling anybody. The city and federal authorities really have very few options in choosing among surplus federal land in the District.

City Council Chairman David A. Clarke, who favors expanding facilities at Lorton, recently put together a list of federally owned sites to be considered if a decision is made to go ahead with a new prison in the District.

Clarke's list includes Rock Creek Park, part of the National Zoological Park, Glover-Archbold Park in upper Northwest, Fort Totten Park in upper Northeast, the area around McMillan Reservoir and the U.S. Soldiers' and Airmen's Home, near North Capitol Street, the National Arboretum on New York Avenue NE; and Kenilworth Aquatic Gardens in Northeast; East Potomac Park, Fort Dupont Park, St. Elizabeths mental hospital and the Congress Heights site near Bolling Air Force Base, all east of the Anacostia River.

Few appear to be the ideal spot for a new prison, at least on first glance.