The nation's trade ledger was in the red for the 12th consecutive month in May. However, because of a big decline in oil imports and coffee imports, the $1.2 billion deficit was the smallest for any month this year.

The Commerce Department yesterday said that overall imports fell to $11.6 billion from April's $12.6 billion, while exports increased to $10.4 billion from April's $10 billion.

The $2.6 billion deficit the nation ran in April was a record.

Treasury Department officials have predicted the nation's trade deficit will run as high as $23 to $25 billion, in large part because of the high cost of oil imports.

Officials such as Treasury Secretary W. Michael Blumenthal have said that while the deficit numbers by themselves are large, they do not indicate that the United States is less competitive in the world ecomony. When oil is factored out, the United States trade balance is in strong surplus.

Carter administration officials say that the U.S. demand for imports helps other countries that are not as far along in recovering from the 1974-75 recession as is the United States.

Rep. Henry S. Reuss (D-Wis.), chairman of the House Banking Committee, said yesterday the Treasury is too lax about the trade deficit. He noted that the U.S. share of world exports of manufactured goods has been steadily slipping.

He warned that demands for protection from import competition could escalate in American industries. "Should the United States resort to portectionism across the board, other nations would retaliate and even more jobs in the United States would disappear," Reuss said.

Even though the trade deficit was much smaller in May than in April, for the first five months of the year the excess of imports over exports of $9.8 billion is nearly 27 times bigger than the $360.9 billion deficit the nation experienced in the first five months of 1976.

For all of last year the deficit totalled $5.7 billion.

Imports of oil products totalled $3 billion, compared with $3.9 billion in April. The U.S. purchased 228.5 million barrels of oil and oil products in May, down from the nearly 289 million barrels it bought in April.

But while oil imports may vary from month to month, the trend for U.S. oil imports is upward over the next several years at least as domestic oil production continues to decline. Few of President Carter's energy proposals will reduce oil imports in the near future.

A fall-off in coffee imports, reflecting perhaps declining consumption because of sharply higher prices, was the other major contributor to the decline in imports, the Commerce Department said.

The department said the there was a big increase in U.S. exports of machinery, with much of it in transportation equipment.

For the first five months of the year exports totalled $49.8 billion, 8.2 per cent higher than the $46 billion the U.S. sold abroad between January and May of last year. But imports totalled $59.6 billion, 28.7 per cent higher than the $46.3 billion the nation imported in the like 1976 period.