For the handful of congressmen clustered in the House of Representatives chamber when yesterday's session began, the opening prayer by the Rev. Edward G. Latch was precisely what they wanted to hear.

The House chaplain voiced a hope that the year's congressional work would come to an end with an anticipated adjournment last night, letting members go home to campaign for reelection.

Only after Latch concluded with the traditional "amen" did House speaker Thomas P. (Tip) O'Neill (D-Mass.) announce that the 77-year-old clergyman is retiring after 12 years of service to the House. The members stood in tribute.

For Latch, the chaplaincy of the House capped a 37-year career as a Washington religious leader. From 1941 to 1967, he was pastor of one of Washington's foremost Protestant congregations, the Metropolitan Memorial Methodist Church on Nebraska Avenue NW.

A tall, husky man, who always wore a clerical collar while on duty. Latch said the $22,000-a-year chaplaincy was a full-time job. His duties included counseling law-makers and staff members on personal problems and orienting visiting clergymen who are invited to give opening prayers in the House two days a week.

"Now that I'm leaving, I think I would like to broadcast to the nation the high caliber of the men and women who work in our Congress." Latch told a reporter "I'm personally impressed. The impression of all the scalawags just is not the case."

With retirement, Latch said he expects to undergo medical treatment and possible surgery for a heart ailment. Earlier, he had an operation to remove cataracts from his eyes.

He said he and his wife would continue to live in Gaithersburg.

O'Neill appointed a special committee composed of Rep. George H. Mahon (D-Tex.). Majority Leader Jim Wright (D-Tex.) and Minority Leader John J. Rhodes (R-Ariz.) to recommend a successor when Congress convenes in January.