The United States imported $13.4 billion more than it exported in June as the merchandise trade deficit continued to outrun last year's record pace, the Commerce Department reported yesterday.

Last month's total, the second-highest ever, widened the trade gap so far this year to $70.7 billion, compared with $60.1 billion at midyear 1984. The administration has warned that the 1985 deficit could be as much as $27 billion more than last year's record $123 billion shortfall.

The trade figures were released amid rising protectionist sentiment on Capitol Hill, largely aimed at Japan, which is the target of several retaliatory measures. The deficit with Japan in June matched the previous monthly high, $4.7 billion.

The trade deficit has been blamed for the sluggish performance of the U.S. economy in the past year because sales and market share, which ordinarily would have gone to American companies, has been diverted to foreign firms.

Moreover, the deficit reflects not only the success of imports here, but also the inability of U.S. factories and farms to sell their goods overseas.

Since January, U.S. manufacturers have lost 220,000 jobs, many of which some economists say are associated with the increase in imports and weak performance of U.S. exports.

Economists say the high value of the dollar, rather than import barriers, is the cause of much of the trade deficit, because it makes foreign goods relatively cheap for American consumers while making U.S. products more expensive overseas. These economists note that U.S. products are meeting resistance in almost all world markets.

Yesterday, Japanese Prime Minister Yasuhiro Nakasone, in an attempt to fend off dozens of bills aimed at Japanese goods, unveiled a program to remove trade barriers to foreign goods. However, leading proponents of protectionist measures said they doubted the sincerity of the new Japanese program and planned to press forward with their legislation. The White House said it would reserve judgment on the plan "until the effect of the program on our exports is realized."

Last month's $4.7 billion trade deficit with Japan would amount to $54.9 billion for the year if the deficit ran at that rate each month. The trade deficit with Japan last year was $37 billion.

Many economists said the 12 percent decline in the dollar since February should prevent the nation's trade position from deteriorating as rapidly as it has in the last several months, and that the residual effects of the dollar's high last winter are now passing through the system. However, they also warned that the import picture could get worse before it gets better.

Commerce Secretary Malcolm Baldrige said the dollar "remains nearly 40 percent above its average in 1980. A much larger drop is necessary to improve our competitiveness in the world economy and we need strong action on budget deficit reduction to accomplish this."

Baldrige also noted that the trade balance in manufactured goods has been particularly hard hit by the dollar and that the "second-quarter deficit in manufacturing was $108.4 billion at an annual rate, compared with a surplus of $12 billion in 1980. The trade balance in manufactured goods has deteriorated as a result of the high dollar and more rapid growth in the U.S. than in foreign economies."

"Although the dollar appears to be on a downward trajectory, there is little relief in sight on the trade front," said Jerry Jasinowski, chief economist for the National Association of Manufacturers. Prices of imports will increase as the dollar declines, but in the short run the higher value of those imported products will make the trade deficit worse before American firms can become more competitive and increase exports, Jasinowski said.

In addition, the drop in oil prices "is having the perverse effect of raising the volume of oil imported more rapidly than the fall in the cost," Jasinowski said. "The reality is that the dollar has not declined enough yet to get us out of the competitive hole we have gotten ourselves into."

Some economists dispute the assertion that the nation pays a huge cost in lost jobs because of the trade deficit. While the trade deficit has grown, they point out, about seven million jobs have been created during the Reagan administration. Herbert Stein, one economist who holds this view, also argues that sales to this country provide the rest of the world with the funds to increase their investments in the United States.

The value of petroleum-products imports jumped 8.1 percent last month percent despite a drop of 24 cents per barrel in the average price in June. Other imports strongly contributing to the June deficit were iron and steel plate and sheets, footwear and organic chemicals, Commerce said. Imports declined in clothing; aircraft and parts, and inorganic chemicals.

Exports increased in automobile and tractor parts, power generating machinery, general industrial machinery, new passenger cars and wheat. Exports dropped in aircraft and parts, office machines and data processing equipment, electrical machinery, bituminous coal and manufactured fertilizers.

Imports last month were $30.9 billion, above the monthly average of $29.8 billion during the first six months of the year. Exports were $17.4 billion, below this year's monthly average of $18.1 billion.

U.S. imports of high-tech products from Japan almost tripled between 1980 and 1984, according to the Institute for International Economics. Total imports from Japan have risen 83 percent since 1980.

The imports from South Korea, Taiwan, Hong Kong and Singapore almost equal the value of imports from Japan, excluding automotive products, according to Howard F. Rosen, a research associate at the institute.

Last month, the United States also had a trade deficit of $1.7 billion with Canada, $2.6 billion with Western Europe and $370.9 million with Mexico