At his first appearance at a black Washington church since his election, President Jimmy Carter yesterday joined D.C. Mayor Walter Washington and the Rev. Martin Luther King Sr. in a music-filled, shouting celebration of the 113th anniversary of the Zion Baptist Church.

It was an occasion marked by Carter's effusive praise of Mr. King - "I was elected to a great extent because Martin Luther King Sr. was my friend - and Mayor Washington's equally effusive praise of Carter for his recent strong stand in favor of complete home rule for the District of Columbia.

The service at the now affluent church, founded in 1864 by a group of ex-slaves, provided Carter with an opportunity to improve his relations with black voters and for city officials to be seen with the President.

Praising Mr. King, Carter said, "it's a rare occasion when one or two people, or a small family, can turn the world upside down. But if there has been one small group that has changed the consciousness of the world, that has changed the habits and attitudes and customs and mistakes, of a great nation like our own, that have offered equality and freedom to millions of people, black and white . . . it's the family of the Martin Luther Kings.

"It's an honor for me to call him my friend. He's a man who's not proud of himself," said Carter, "because he realizes that his strength comes from God. And there could have been no way in my opinion that his son could have lived through the . . . scorn, the suffering, the abuse, the imprisonment, the disapointments of the great civil rights movement, had he not had behind him a great father, a great mother, a great wife . . ."

Carter then told the congregation, including 450 parishioners watching him over closed circuit television in a basement room, that it is up to the President and Congress to carry on Martin Luther King Jr's work.

"Dealing with a sometimes independent and sometimes recalcitrant Congress, and as I want to establish good jobs for people, a fair welfare program, a fair tax program, human rights around the world my problem is not the Black Caucus, my problem is with the white caucus," said Carter, whose remark drew appreciative laughter from the congregation.

Carter, his wife, Rosalynn, and their daughter, Amy shared the first pew in the starkly handsome modern church at 4850 Blagden Ave. NW, with the mayor and Mrs. Walter Washington, D.C. Superior Court Judge Robert Campbell, City Councilman Marion Barry and Joseph P. Yeldell, former D.C. Department of Human Resources Director, and close aid and confidant of Washington. The Rev. Carlton Veazey, the minister said he invited the District official who attended, all of whom are his personal friends.

The Mayor used the occasion to praise Carter for his decision last week to back full congressional voting representation for the District.

"It's glorious that the Lord has spared you to be here this morning," Washington told Carter. "This great president of ours has struck a blow for human rights and dignity."

Carter has "struck down second-class citizenship when he said the time has come, the time has come," said Washington, speaking in the cadance of generations of Southern Baptist preachers, "for the citizens of the District of Columbia to chart their own course.

"Stand with me a minute and just say, 'Thank you, Mr. President, we're behind you," the mayor told the congregation.

The 900 persons in the main area of the church rose as one and said, "Thank you, Mr. President, we're behind you!"

Carter has come under fire in recent months from some black leaders charging that he has been insensitive to the pressing needs of the very voters who provided him wiht his winning majority.

Yesterday's appearance at Zion Baptist Church, together with his attendance 14 hours earlier at the Congessional Black Caucus's annual banquet and the fact that Wednesday he took perhaps the strongest position in favor of D.C. home rule taken by a President appeared to be politically well orchestrated.

However, both hte White House and Mr. Veazey said the timing was purely coincidental.

"I sent the President a letter (of invitation) over two months ago," said Mr. Veazey. "I got a letter a month ago saying they'd like to come but they didn't know if they'd be able to." Then Thursday, Mr. Veazy received a phone call from the White house informing him that the President would attend the 11 a.m. service.

"I think he came because he has a commitment to the people of the District and I think it's also because of his admiration of Dr. King," said Mr. Veazey.

The White House said Carter attended the service primarily out of admiration for Martin Luther King Sr.

"One reason the President wanted to go to introduce Rev. King is that there's a dinner in New York in the near future in Rev. King's honor and the President isn't going to be able to make it," said a White House spokeswoman.

"If he could work it into his schedule to introduce 'Daddy King' he would," said the spokeswoman, "whether the Black Caucus was meeting or not."

Earlier in the morning the President taught the adult Sunday school class at the First Baptist Church, the mostly white congregations to which he belongs in Washington.

Carter spoke on the 10th Commandment - Thou shalt not covet - and warned his fellow Baptists that they would be judged by their actions and faith in God rather than by their material possessions and wordly power and status.