Mainly because of oil imports, the United States recorded its 20th consecutive monthly trade deficit last month, the Commerce Department rported.

Imports outstripped exports by $2.4 billion.

The continuing trade deficit is one of the factors that has been driving down the value of the dollar. The decline of the dollar has added to U. S. inflation and caused problems with such U. S. trading partners as West Germany, whose goods become more costly and less attractive to U. S. buyers as the dollar falls.

The January deficit was about equal to the average monthly deficit in 1977. Last year the trade imbalance was a record $26.6 billion.

Administration officials say the deficit should be smaller this year because oil imports are expected to level off and other countries' economies should be strong enough to allow them to buy more U. S. products.

In January, exports declined from $11 billion to $10 billion, while imports dropped from $13.1 billion to $12.4 billion.

Courtenay Slater, chief Commerce Department economist, said the January deficit would have been smaller were it not for the lingering effects of the longshoremen's strike last fall.

She said shipments, delayed by the October-November strike, arrived in large amounts than usual in January.

The January deficit of $2.38 billion was the largest since a record $3.62 billion deficit in October, and followed deficits of $2.35 billion in November and $2.12 billion in December.

Almost all exports and imports decline for the month, but oil imports rose 4 percent from $3.1 billion to $3.2 billion.

Exports showing big declines were chemicals, machinery and transportation equipment, all dropping more than 10 percent.

The department did not have a breakdown by most categories because a snowstorm at the data-gathering center in Jeffersonville, Ind., last month kept statistical workers away from work for several days.

The department also changing the way it gathers trade figures to match worldwide standards, officials said. The new system changed the 1977 deficit from $26.7 billioto $26.6 billion.