Federal agencies quietly stiffened security in downtown government buildings yesterday following a rash of violence - shooting at the District Building and hostages taken by armed men at two religious centers - in the city.

For a while there we thought there might be some kind of conspiracy," a federal security official said, "and we tried to put the lid on in-coming traffic" at many federal installations. The official, who asked not to be identified, said off-duty guards were called by some agencies and at others guards reported for work on their own. "But there was no panic as far as we know, although it was a helluva mess" at the District Building where City Councilman Marion Barry was wounded.

Capitol Hill police went on special alert following reports of the shottings and taking of hostages down-town. Patrols were stepped up in congressional buildings, officials say, and near the Supreme Court building and the Library of Congress.

Employees at several Defense installations in suburban Maryland and Virginia reported seeing guards with shotguns, although they usually are either unarmed or armed only with service revolvers.

One administrative officer, charged with security in the Federal Triangle area, said it was "pretty much business as usual , although a lot of people were looking for a radio or TV set, or talking to friends on the phone trying to find out what was happening."

"If you plan to enter a federal building in the near future," he said "I'd suggest you have a pass and if you are carrying any packages or a shopping bag you can expect it will be searched."