A sharp rise in exports and a drop in oil imports combined to cut the nation's merchandise trade deficit from $5.57 billion in February to $3.16 billion in March, the Commerce Department reported yesterday.

Exports, after declining in February, increased 7.6 percent to $18.53 billion as sales abroad of both agricultural commodities and manufactured goods rose in March.

Imports, including the value of insurance and freight, fell 4.9 percent to $21.69 billion. A new law prohibits Commerce from making public for three more days data it has comparing exports and imports on the same basis, that is, not including the cost of insurance and freight.

On that basis, the March deficit probably was only about $2 billion, analysts said.

Oil imports fell from about 8.8 million barrels a day in February to about 7.5 million daily last month, the department said. Late statistics from the Department of Energy indicate oil imports dropped further this month.

The decline in oil imports more than offset an increase in the average price from $29.81 a barrel in February to $31.19 a barrel in March. Overall, the oil trade deficit fell from $7.47 billion to $7.03 billion despite the higher average price.

Also boosting the export total was a sharp increase in the amount of gold exported. Non-monetary gold exports climbed from $163 million in February to $477 million last month, the department said.

During March, the United States recorded a $3.64 billion trade deficit with the member nations of the Organizagion of Petroleum Exporting Countries. The deficit with Japan fell to $729 million, down $250 million from February and nearly $500 million from January's level.

The United States, on the other hand, had a $1.73 billion trade surplus with the nations of western Europe.

The value of imports of a wide range of goods other than oil also dropped in March. Passenger car imports fell $358 million to just over $1 billion. Iron and steel imports declined by $164 million to $686 million.

For the first quarter as a whole, imports were up 22 percent compared to the first three months of 1979, while exports rose 17 percent over the same period. The cost of imported energy products nearly doubled, however, rising from $11.71 billion last year to $21.33 billion this year.