In part because of an aggressive grain-sales policy, U.S. trade with the Soviet Union is pushing toward its second-highest level in history, even though the Reagan administration continues to take a tough line toward Moscow on military matters.

The Department of Commerce is projecting $3.2 billion in exports to the Soviet Union, the bulk of it in farm products, which would put 1981 just behind the record trade year, 1979, when relations between the two superpowers were less frayed.

This apparent anomaly, feeding the Russian bear while arming against it, has raised some eyebrows on Capitol Hill and jangled some foreign-policy nerves within the administration. In Congress, an effort is afoot to force export grain prices to a level closer to actual production costs.

The problem, if it can be called that, is at bottom agricultural.

Soviet farmers have just gone through a third straight poor harvest and the country needs vital grains. U.S. farmers are slogging through another record harvest of wheat and near-record harvest of corn and need desperately to sell.

And the Reagan administration, seeking at every point to control the federal budget, needs just as desperately to get the grain sold. Otherwise, the record wheat crop carries the potential for payment of some $500 million in unanticipated subsidies to wheat farmers; the large harvest is depressing market prices.

An agreement concluded last week by Department of Agriculture negotiators opened the way to millions of tons in new grain purchases by the Russians during the next 12 months and may go a long way toward defusing the threat of new federal budget outlays.

As the grain deal was being worked out, President Reagan was tying down the final points of a new missiles-and-bombers construction program, aimed at deterring what he sees as increasing hostility in the Soviet Union.

Rep. James Weaver (D-Ore.), sponsor of a farm-bill amendment that would require higher prices for U.S. grain exports, cited last week's events as the sort of political contradiction that sends farmers up the wall.

Inside the administration, senior foreign policy officials concede that the big sale of grain to the Russians is not entirely consistent with the main trend of U.S.-Soviet relations. But, they go on, the grain deals this year are part of a political jigsaw with many pieces.

One of those pieces has been a behind-the-scenes struggle between Agriculture Secretary John R. Block and Secretary of State Alexander M. Haig Jr. over the agricultural sales to the Russians, and international agricultural policy generally.

Once the president kept his promise and lifted former president Carter's embargo--a policy switch that Block was for and Haig against--the way was clear for the administration to get on with its pledge of increasing U.S. farm exports.

That has happened to a fare-thee-well, with Block's goal of wider farm sales in the ascendancy. He has said repeatedly that a major way to rehabilitate the farm economy is to broaden U.S. overseas markets.

Block, for his part, sees no contradiction between the agricultural and defense thrusts. His standard response to this question is that as long as the Russians are buying U.S. farm products, it is money they cannot spend on weaponry. Russian eagerness to buy, he adds, is a boon to American wheat and corn farmers.

As a result of the new grain trading, Department of Commerce economists are projecting overall 1981 exports of $3.2 billion to the Soviet Union, with an estimated $2.6 billion of that in agricultural products --largely corn, wheat and soybeans.

When sales reached a peak between the two countries in 1979, U.S. exports amounted to $3.6 billion. Of that, agricultural products accounted for $2.8 billion. A year later, when Carter imposed his partial ban on sales after the Soviets invaded Afghanistan, total trade fell to $1.5 billion, with farm goods bringing in $1 billion of that.

But farm-state legislators in Congress don't see entirely eye-to-eye with the administration's push for expanded exports--at least at current prices, which are consistently less than what American farmers spend to produce their grain.

"We are subsidizing the Soviet Union with our sales of grain at less than the cost of production," said Weaver. "This grain sold at less than cost finances their army in Afghanistan."

Weaver's amendment is opposed by the administration, by most major farm groups and by grain trading companies, who see it as an intrusion into free trade that could hurt U.S. farmers by pricing them out of world markets.

The Oregon Democrat's amendment was rejected by the Agriculture Committee, but it is likely to be debated this week when the House takes up the farm bill that will guide U.S. agricultural policy for the next four years.

"I say make the Russians pay for their grain," Weaver says in support of his amendment. "I've been saying this for six years. Politicians don't realize how powerful this is. True, it would put the government into the pricing business, and I'm not happy about that. But we are selling our grain at a loss now--not gouging anyone."