As the sun set on the homeless shelter at Second and D streets NW Friday night, more than 700 men and a few women streamed in for what many believed would be one of their last nights under a roof. Within a few hours, and with heat rising above 100 degrees, the place had become a hell hole of humidity and hot tempers as rumors that they would be evicted next month filled the air.

"Lordy, what do you know about this situation?" an elderly man prayed aloud. He is one of many mentally disabled people who live in the shelter, and once he got wound up other residents became unnerved.

"Is the president going to give us the yams money or what?" a man called out as Mitch Snyder made his nightly rounds to check on his constituents. Snyder, a nationally known community activist who runs the shelter, tried to calm the residents' fears. "Nothing positive yet," he replied. "But we haven't given up the fight. We're marching next week. Be there."

Earlier on Friday, federal officials announced their intention to shut down the shelter and ordered Snyder and his group, the Community for Creative Non-Violence, to vacate the building by July 10. Instead of making the building a "model" shelter for the homeless, as President Reagan promised last fall, the plan now is to raze the structure and channel federal funds to District officials, who have agreed to find homes for these people.

But that will be easier said than done, for this shelter reflects the consequences of sustained poverty and severe medical neglect. It is more like a turn-of-the-century insane asylum, a dumping ground where society's traditionally disposable products -- old, disabled and sick people -- are brought in and dropped off by relatives, police and sometimes officials from St. Elizabeths mental hospital under the sham that is called "deinstitutionalization."

The building, a four-story structure of about 185,000 square feet, is a monstrosity of steel columns and concrete floors in an eye-numbing state of disrepair. Laid out like a maze, it is a place of hideaway rooms with virtually no ventilation.

Men were lined up, sometimes 30 deep, awaiting use of the working shower stalls.

Restrooms are rare, as are toilet paper and soap. A debilitating strain of month-old foot funk and unwashed underwear filled the air.

The shelter has no facilities for cooking or storing food, and it offers no medical care. In a nutshell, it is an abandoned building with lights and a trickle of running water.

A staff of 40 volunteers, led by Snyder, lives on the third floor of the building in quarters not much better than those of the residents. Their job is to monitor the residents, break up fights and make sure everybody has a bed.

Among the residents Friday night was a man called "Charlemagne," who wore a girdle and stockings, showing off breasts enlarged from taking estrogen. Then there was "Whistler," named for the tune he carried as he constantly strolled the halls, nude except for a blanket. One resident suffering from cancer moaned in agony while a blind man clung to the walls for balance and safety.

Dennis Brown, 24, born without vocal cords, was there. Since his father died in Vietnam and his mother died of a heart attack, he has had to fend for himself.

"I have lived on the streets and in the woods for six years," Brown wrote. "I walk two to three days without sleep to find a shelter for food. I survive the only way I can, but one thing I never have done and never will do is steal."

The culturally handicapped leaned ominously in doorways of what were classrooms when the building was owned by Federal City College. Some of the men now sleep in rooms where they once took courses, others in broom closets and even restrooms. Their anger and frustration is manifest in the holes punched and kicked into the walls.

In the women's section of the shelter, there lives a mother whose children kicked her out. Shelter workers say that when the offspring, who live comfortably in the Washington suburbs, were notified that their mother had been raped while scavenging for food in an alley garbage can, they still refused to take her home; she had become a drag, they said.

Lumped together under one dilapidated roof since the shelter opened 18 months ago, Snyder's people have had a ringside seat to a political battle that has employed hunger strikes and marches, shelter designs and construction costs, expediency and reaction. Now it appears that their home will be torn down, and they don't feel any better knowing that nobody seems to care what they think -- not that they really know what to think.

"All I want is a little sleep," said Benjamin Hamilton, 58, weary and wan with fatigue. "If I could just get a couple of drinks, I could pass out, not that it would be sleep -- not with 25 guys to a room."

At best, he and the other castoffs have been put in a position of defending as home a place where most people wouldn't even send their dogs.