Mayor Marion Barry, preaching a sermon is the church where he is a member, promised yesterday to join the nation's other big-city mayors in pushing for adequate federal support for social programs and resisting what he called political and social shift to the right.

Nothing plans by the Carter administration to increase defense spending while curtailing outlays for social and urban programs, Barry told about 300 people at All Souls' Unitarian Church that "our (national) priorities need to be reordered."

"I am going to stand with my colleagues all over the country," he said, referrig to other mayors. "The poor people in American don't have anybody to speak for them," Barry said.

"We have a moral obligation... to stand up and demand that they are treated the right way."

Among the most urgent needs, Barry said, is the early congressional enactment of a national health indurance program, sponsored chiefly by Sen. Edward M. Kennedy (D-Mass.)., who spole at the mayor's inauguration last Tuesday. The Carter administration advocates a slower move toward such a program.

When a mother in Wahington's impoverished Anacostia neighborhood hears her sick baby cry in the night, Barry said, "she has to wonder if it is a $50 cry or a $200 cry. The fact is," he said, "she has neither $50 nor $200" to pay for treatment.

Barry's announced intention to become active in national urban affairs is a shift from the policies of former Mayor Walter E. Washongton, who believed a passive course would not antagonize the White House or Congress and would therfore produce better treatment for the District of Columbia.

Barry was repeatedly applauded by the theologically liberal congregation. Some of the loudest clapping came when Barry said he was "determined to take the boards off these (vacant city-owned) house and put people in them," and when he promised that citizens will get courteous treatment when they telephone municipal agencies.

The mayor stressed a need for improved education. "In a highly technological society, you have to have skills and capabilities," he said.

A few weeks ago, Barry said, he visited Cardozo High School. "I wasn't sure I was in a school or where I was, really, there was so much noise, so much going on in the hallway and in theclassroom that anybody who wanted to learn couldn't learn." In restrooms, he said, he found flagrant use of drugs.

Waverly E. Jones, acting principal of Cardozo, would not comment about Barry's statement. School Superintendent Vincent E. Reed said that "if there was something at Cardozo he (Barry) thought was wrong he didn't bring it to my attention. I don't know anything about it."

Barry shared the pulpit with two other All Souls' members who serve on the City Council, Hilda Mason (Statehood-At Large) and Betty Ann Kane (D.-At Large). Both, like Barry, are former school board members.

Although most of Barry's sermon was serious in tone and content, the mayor bantered with the Rev. David H. Eaton, minister of the church, over Eaton's role in the September Democratic primary campaign.

Eaton was among a group who sought five days before the election to persuade Barry to drop out. Supporters of them-City Council chairman Sterling Tucker, who was at that time regarded as the stronger of the two nonincumbent candidates, feared that Barry's presence would split the vote and ensure Washington's renomination. Barry spurned the overture.

"He (Eaton) has ministered unto me," Barry said amid laughter, "and I've occasionally ministered unto him."

Barry also recalled that, during the campaign, ministers of the Baptist Church, his childhood denomination, attacked him for "the three G's -- grass, gays and gambling." Barry supported liberalization of laws dealing in those areas.

But that, to the ministers, "wasn't as bad as (my) not being a Baptist," Barry said with a grin.

Barry's sermon was praised by congregation members interviewed afterward.

"I think he was saying to us, keep up the pressure, continue to support him and urge him on," said Vic Simon, a staff attorney for the D.C. Office of Consumer Protection.

"It was inspirational," said Ernest Matthews, a federal government public affairs officer. "He wants to look at problems and do something about them that isn't being done now."