Orders for manufactured goods climbed 1.7 percent in June, the fifth consecutive monthly increase, as U.S. factories continued to reap the benefits of rising foreign demand, the government reported yesterday.

The Commerce Department said orders for both durable and nondurable goods totaled a seasonally adjusted $204.8 billion in June following a 0.4 percent increase in May.

A rise in orders for factory goods, which often signals increased production and employment in manufacturing industries, is considered a good barometer of future economic prospects.

Robert Ortner, undersecretary of Commerce for economic affairs, said orders for durable goods -- items expected to last three or more years -- climbed by 6.3 percent during the April-June period, the best quarterly performance in more than three years.

"A good part of the increase is coming in foreign orders, which reflects the decline in the dollar," Ortner said.

Private economists agreed that the lower dollar is boosting export sales. "We are clearly getting a turnaround. With the dollar becoming more competitive, we are picking up many more orders both from domestic buyers and also overseas," said David Wyss, an economist with Data Resources Inc. of Lexington, Mass.

The administration in 1985 began a two-year effort to push the value of the dollar lower as a way to trim the U.S. foreign trade deficit.

A lower dollar makes imports more expensive while lowering the cost of American goods on foreign markets.

The dollar devaluation drive took longer than expected to bear fruit, but the Reagan administration is still counting on a narrowing of the trade deficit to dampen protectionist demands in Congress.

"We are seeing a strong pickup in machinery and steel this year, with much of the demand in machinery coming from export sales. That is very promising," said Priscilla Luce Trumbull, an economist with Wharton Econometrics of Bala Cynwyd, Pa.

She predicted continued strength in coming months except in autos, where she said a high backlog of unsold cars was forcing auto makers to cut production.

The 1.7 percent overall increase was the largest since a 2.6 percent rise in March. The gains were spread evenly in the civilian and defense categories.

Orders for defense equipment climbed 12.5 percent to $10.6 billion during the month, reflecting a big gain in shipbuilding and tanks. Excluding defense, orders rose 1.2 percent in June, matching the May increase in the civilian sector.

Orders for durable goods climbed 1.6 percent in June following no increase in May.

Orders in the key category of nondefense capital goods, considered a good barometer of business investment plans, dropped 1.5 percent during June, but analysts were not concerned because the decline followed two months of strong advances.

Orders for nondurable goods climbed 1.8 percent in June with all the major industries showing gains with the exception of chemicals.

The increase followed a 0.8 percent decline in May.

The backlog of unfilled orders, also considered a good signal of whether production will be increasing, rose 1.1 percent to $384.6 billion, the fourth consecutive monthly increase.

Shipments of manufactured goods rose 1.1 percent in June to $384.6 billion, the fourth consecutive monthly increase