D.C. Mayor Marion Barry was raucously booed and shouted down yesterday by nearly 1,000 laid-off District government employes, forcing him to leave a city-sponsored "Job Fair" for the workers through a back door.

The confrontation in the main ballroom of the Mayflower Hotel was perhaps the most tumultuous that the mayor has had to face over the cost-cutting measures and staff layoffs he ordered to help ease the city's budget crisis.

As Barry walked into the room, he was quickly surrounded by angry workers whose jobs he had ordered eliminated. The crowd resoundingly booed him during a 25-minute attempt to speak, and Barry's bodyguard finally ushered him through an adjacent kitchen and out of the back door.

Barry held a brief news conference afterwards in another part of the hotel, plopping heavily into a chair and muttering, "Oh Jesus." But he said he was unfazed and had anticipated the workers' anger.

Asked why he had decided to come despite the knowledge that he would be unwelcome, Barry responded, "Because I'm sensitive, I'm compassionate and I also have the courage to go where the problems are. You'll find Marion Barry there."

Some workers had another view of his appearance. Jerry Spence, a D.C. teacher laid off after 10 years on the job, said, "He is just here for show. That's all it is to me."

The Job Fair was organized by city officials to put the laid-off workers in contact with about 65 potential employers, including the federal agencies, state and municipal governments and private firms.

Asked to attend the invitation-only event were about 1,000 regular employes who have been laid off this year, plus another 1,000 workers whose eligibility for federally sponsored Comprehensive Employment and Training Act jobs with the District government expired.

Barry was scheduled to arrive at the ballroom at 10:30 a.m., but showed up an hour late. Meanwhile, some of the workers had begun to complain that the Job Fair wasn't doing them any good.

Many of the laid-off workers had been among the lowest-ranking in the District government, and lacked the clerical, technical or administrative skills sought by the assembled prospective employers, which included banks and insurance firms, as well as public-sector agencies looking for middle-management talent.

"They told us to come down here, to wear 'proper business attire,' so I went out and got my suit pressed and everything," said Roscoe Ridley, a laid-off plummer. "Hell, I could have worn my work clothes for all I'm getting out of this. All the jobs here are technical or else administrative. There's nothing here for me."

Barry told the crowd, "If I were losing my job for any reason, I would be booing, too." Someone near the front of the crowd yelled back, "You will be in two years," referring to the expiration of Barry's term at the end of 1982.

At another point someone else shouted that Barry was losing potential votes through the layoffs he ordered. "I'm not running for anything, so don't worry about votes," Barry shouted back. "You hear that?" Barry later said he had made no decision about seeking reelection in 1982.

Throughout his frequently interrupted talk to the crowd, Barry maintained an attitude that was interpreted by some as cockiness. His legs crossed casually, the mayor leaned on one elbow against the podium, sometimes gesturing to make a point, sometimes putting a hand on his hip.

He told the workers repeatedly that he had expected them to be angry. But each time he said this, a rumble went through the crowd. "He hasn't said a thing," said one worker. "All he's doing is telling us we're mad. So what?"

On several occasions, Barry invited the crowd's booing. "You want to scream?" he asked. "You want to scream some more?"

"you ain't committed to nothing," an unidentified worker yelled back. "The things you were talking about when you were at SNCC and at Pride, you ain't talking about any more."

The reference was to Barry's activist past, with organizations like the Student Nonviolent Coordinating Committee and Pride Inc., which he founded.

As he left the stage, Barry was confronted by workers who complained that the employers at the Job Fair were just taking names and promising to get back in touch. "I never thought they would sign you up on the spot," Barry told them.

Joseph Hill, a laid-off Department of Environmental Services worker, screamed at the mayor that he and several others were losing their jobs after going through a multiyear training program and being promised not only job security but steady advancement. Barry promised to look into the complaint, but gave little hope that the jobs could be saved.

At his subsequent press conference, Barry said, "I wanted to reiterate that I am not at all upset or disturbed at the attitudes (of the workers). I'm surprised I wasn't booed more. I thought I would get 15 or 20 minutes of solid booing."

"For all those Doubting Thomases who thought there wasn't a budget crisis, you can go in that ballroom and see that we're in a crisis," Barry said. "You can see it out there in the human misery, the human feelings."

Asked if he was worred about his chances of being reelected as mayor should he choose to run again, Barry said, "I'm always a viable candidate for anything I run for. I've never lost an election."

Barry, who was supported by the police, firefighters' and teachers' unions in 1978, said he would not hesitate to ask for their support again. He said any labor leader who did not protest layoffs was "not worth the salt that's in his body."

Barry said he realized that not all the workers would find jobs at the Job Fair, but said that even if only a few find employment the event will have been worthwhile.

"I never thought I would be the mayor who's presiding over people losing their jobs," he said.

What, Barry was asked, had he intended to tell the workers? "I didn't come with a message. I came to look and listen and be booed."