Two black contractors were sentenced here today to four months in jail and a $10,000 fine each for illegally posing as owners of a minority-owned business in order to secure special federal contracts for a large white-owned construction firm.

U.S. District Court Judge Frank A. Kaufman told the pair they had "prostituted programs" meant to help small and minority-owned businesses.

Kaufman also noted that the two contractors, Raymond L. Rice, 43, and Jesse G. Williams, 44, had excellent personal and work-related backgrounds. He ordered them to provide an unspecified amount of community service during the 4 1/2 years they will be on probation. He said they should teach others how to organize a genuine small business.

Rice and Williams were convicted last May of conspiracy to defraud the federal government and making false statements to the Small Business Administration.

The U.S. Attorney's office here said it was the first time contractors had been convicted of abusing government programs designed to foster small- and minority-owned firms by guaranteeing them a share of the government's business.

Prosecutors had charged that the company the two men orgnaized, R & W Construction, actually was an affiliate of Excavation Construction Inc., a million-dollar Prince George's County company owned by whites.

When R & W won a $2.4-million construction contract that had been earmarked for a small business, the firm immediately turned over a lucrative management contract for the project to Excavation Construction, prosecutors said.

Two officers of Excavation Construction, who had lent workers and equipment to R&W for the job at the U.S. Naval Academy, were named as unindicted conspirators in the case.

Excavation Construction recently filed for reorganization under the federal bankruptcy law.