Major U.S. coffee companies said yesterday that they would favor legislation outlawing U.S. imports of Ugandan coffee because of human rights violations by Ugandan President Idi Amin.

Some of the companies have stopped buying Ugandan coffee, but their spokesman said yesterday that Congress should take a stand, instead of leaving responsibility in private hands.

Procter & Gamble (which makes Folgers coffee) and General Foods (which makes Maxwell House, Yuban, Maxim, Sanka, MaxPax and Brim) said they decided on their boycott as a result of a resolution in May by the House International Relations Committee urging President Carter to impose a trade embargo against Uganda.

Chock Full o' Nuts stopped purchasing Ugandan coffee two years ago.

But some of General Foods' overseas businesses purchase Ugandan coffee. Andrew Schroder, General Foods' vice president for public affairs, denied that the company would buy Ugandan coffee for the United States through its overseas subsidiaries.

The Nestle Co. and Hills Brothers Co. also have stopped buying coffee from Uganda, although their representative did not appear at the hearing of the Senate foreign economic policy subcommittee.

Kenneth Dunnivant, manager of the Folger Co., told the subcommittee that a mandatory ban would be an "appropriate decision" by Congress. Representatives of General Foods and Chock Full o' Nuts made similar statements.

Five percent of the United States' imported coffee has come from Uganda. Coffee accounts for 93 per cent of Uganda's export earnings, with coffee purchases accounting for 33 percent of those earnings.

Rep. Conald J. Pease (D-Ohio) said that from 50,000 to 300,000 people have been slain in Uganda since Amin came to power in 1971. He said Amin stays in power by keeping his secret police and mercenary army well-paid - with money from coffee exports.

Pease told the Senate panel that the United States must disassociate itself from the regime. "If we can get Britain, West Germany, France, the Netherlands and Japan to follow suit, we can cut 75 percent of Uganda's market."