The nation's foreign trade deficit narrowed significantly in March, the government reported yesterday, but the red-ink figure remained at historically high levels - continuing the gloomy performance of the past 22 months.

Commerce Department figure showed that imports outpaced exports by $2.78 billion over the month, indicating that the $4.52 billion deficit recorded in February probably was an aberration.

However, the March deficit still was higher than the $2.38 billion posted in January, suggesting that the nation's underlying trade posture may be worsening further, rather than improving as the administration had hoped.

Courtenay M. Slater, the department's chief economist, hailed the new figures as "a major improvement" from the February performance. However, other analysts said the numbers marked "no clear change" from earlier trends.

The heavy red-ink figure came despite a sharp rise in exports and a visisble decline in imports - particularly U.S. purchases of foreign oil, which, encouragingly, dipped a substantial 11.8 percent, or $395 million.

There also was a sharp decline in steel imports, due mainly to the Carter administration's new "minimum pricing" plan to reduce foreign price cutting, whcih took effect in Febraury. Steel prices had soard before, in a last-minute surge.

Yesterday figures showed exports rose by a sizeable 10 percent, or $990 million. By contrast, imports declined 5.2 per cent, or $745.7 million. In Febraury, exports had declined and imports rose sharply.

The new surge in exports was spread throughout all major categories, with especially sharp gains in shipments overseas of American-made aircraft, machinery, manufacturing foods, soybeans and cotton.

However, economists were unable to pinpoint any single reason for the export surge. Some suggested overseas shipments may have been spurred by the thaw in the cold weather here, which had blocked rivers in some states.

Among the categories of imports posting declines in March were machinery, foreign-made motor vehicles and manufactured fertilizers.