As part of its plan to bail out grain companies whose sales to the Soviet Union were canceled, the Department of Agriculture plans to make grain exporters reveal their profits made on foreign sales.

The companies will have to tell the government their export profit margins as a condition of a government offer to buy the grain the Soviets were to get.

Agriculture officials yesterday revealed how they will keep their promise to take the Soviet grain off the market so it will not depress farm prices.

When President Carter halted grain sales to the Soviets on Jan. 4, the administration said it would step into the Russians' shoes and take over all the grain purchase contracts the Soviets had signed with American exporters.

After three weeks of talks with the exporters, the Agriculture Department yesterday made public a 22-page agreement detailing how the grain purchases will be handled.

Assumption of the Russian contracts will be made by the Commodity Credit Corporation, the USDA agency authorized to stabilize farm prices.

USDA General Counsel Dan Marcus said CCC is prepared to spend between $2.25 billion and $2.50 billion to take over the grain the Soviets were to purchase.

Much of that money -- USDA officials don't know how much -- will eventually be recovered when the grain is resold, he stressed.

CCC plans to buy and store about 4.7 million metric tons of wheat. The grain will either be donated to needy nations under U.S. food aid programs, or stored as a reserve against shortages.

Another 11.5 million metric tons of corn was included in the Soviet sales, but the Agriculture Department will try to avoid buying and storing the corn.

Instead, the CCC hopes to take over the contracts for sale of the grain, then resell the contracts without ever handling the massive amount of corn. The administration has promised it will sell the corn only if it can get at least $2.15, a bushel, the price on the day the Soviet sales were halted.

The CCC will buy the grain contracts from the exporters, Marcus said, but will not allow the grain companies to make a profit on the deal. The companies will be paid whatever price they paid for the grain, plus any shipping and storage costs.

To enable the CCC to "wring out the profit" from the grain deals, the companies will have to tell the CCC what their profit margins were on grain exports for the last two years.

Marcus admitted government officials have never before obtained such information, which is regarded as a trade secret by the grain companies. Most of the grain exporters are privately owned multinational companies which never reveal any details of their operations.

USDA will not reveal any of the secret data it obtains from the grain companies, Marcus said. Trade secrets are excluded from the things that must be made public under the federal Freedom of Information Act.

If disputes arise over the size of the grain company profits, they will be decided by a board of three accountants -- one appointed by the government, one by the companies and one from the American Institute of Certified Public Accountants.

Marcus conceded the government may not get a true picture of the grain company profits because of the way the companies conduct their business.

It is believed that many of the grain companies show little if any profit within the United States on their grain exports.Instead the American firm sells grain to a foreign affiliate at a low price. The foreign company then resells the grain at a profit. That way the company doesn't have to pay U.S. income taxes on its earnings.