Blending themes of scripture and the eloquence of the Rev. Martin Luther King Jr., clergymen of many faiths offered thanksgiving prayers yesterday for the safe return of the hostages from Iran.

"We are gathered to celebrate the release of 52 fellow Americans who were . . . unjustly imprisoned," the Rev. William Howland, pastor of National City Christian Church, told 300 persons of all ages, races and creeds at an emotional lunch-hour service at the Thomas Circle church.

D.C. Mayor Marion S. Barry joined with a dozen clergy of Protestant, Catholic, Jewish and Muslim institutions of worship to celebrate the return of the hostages.

"In this same city, in 1963," Barry said, "Martin Luther King stood on the steps of the Lincoln Memorial and said: '. . . from every mountainside, let freedom ring.' Whether in Iran, whether in Russia, in South America or in South Africa or in the District of Columbia, let freedom ring."

In the moving, 45-minute service, which had many worshipers dabbing frequently at their eyes, the deepest emotions seemed to be wrong from the words of ancient scriptures, whose themes of the captive people yearning for freedom, hope in the face of oppression and the call to forgive one's enemies seemed to have written for today's circumstances.

" . . . will call upon God and the Lord shall save me," Rabbi Mark Diamond of Adas Israel read from Psalm 55. "Cast the burden upon the Lord, and he shall sustain thee. He shall never suffer the righteous to be moved."

Two rakish yellow bows encircled the massive pillars of the church. A trumphant arrangement of yellow spider chrysamthemeums and daffodils decked the communion table, and participating clergy had a yellow ribbon pinned to their clerical robes.

At the close of the service, ushers bearing plates heaped with yellow bows for lapels offered departing worshippers the popular symbol of the hostage release. Nearly everyone seemed to take one.

Howland reminded those present that "in our happiness we must not forget the eight men who lost their lives" in the attempt last April to rescue the hostages.

Then he added a note that was reiterated by several clergymen: "Nor can we forget in our joy the Iranian people, themselves oppressed by misguided men."

Howland also offered thanks for those who worked for a peaceful resolution of the hostage crisis, "that an incident that could have erupted into the ultimate terror was avoided."

Imam Khalil Abdul-Alim, local leader of the American Muslim Mission, missed the regular Friday noon worship service of his own masjid, or congregation, to read in English a portion from the Koran that told of God's aid and protection for those who trust in Him.

Barbara Flagg, who works in a nearby law firm, said she went to the service "because I just felt I ought to do something" to express her feelings of thanksgiving for the release of the hostages.

Nour Mahmoud of the Corporation for Public Broadcasting spent his lunch hour at the prayer service "in order to give my whole feeling" to the thanksgiving service.

The Rev. Laverne Rorbaugh of Mount Vernon United Methodist Church led a litany for world peace in which he offered thanks "for former president Jimmy Carter and his untiring efforts toward world peace," as well as prayers for President Reagan.

The service was planned by a group of downtown Catholic and Protestant congregations that cooperate in a variety of community service programs.The Council of Churches also joined in the sponsorship.