For the first time in 17 years -- consumer prices in metropolitan Washington resumed their upward climb in June and July, the Labor Department reported yesterday.

Higher costs for gasoline and electricity accounted for a considerable portion of the 1.0 percent increase in the local cost of living.

Inflation is now running at an annual rate of 6.4 percent in the nation's capital. During the previous two month period, the Consumer Price Index dropped by 0.1 percent.

For the country as a whole, prices rose by 1.8 percent in June and July. During the past 12 months, Washington has lagged behind the national index as often as it has surpassed it. But the overall result has been a less steep upturn in the cost of living here. Since July, 1981, the index has gone up 5.3 percent locally, compared with 6.5 percent across the nation.

The largest single factor in the regional index was a 14 percent hike in electricity charges. This accounted for about four fifths of the increase in housing costs, one of the factors included in the price index. Potomac Electric Power Co. officials said higher summer rates that went into effect in June statements pushed charges up an average of 22.2 percent.

House prices in this area went up just 0.9 percent, compared with 3 percent nationally. According to the National Association of Realtors, the average price in the U.S. increased from $80,600 in May to $82,300 in June. July figures will be released today. In the District, Rufus S. Lusk & Sons reports that the average house price increased from $111,950 to $119,825 in the same period. However, the average price of a condominium sold here declined from $95,235 to $83,535.

Housing costs locally increased by 0.7 percent, compared with 1.8 percent nationally. Residential rents were up by 0.3 percent and 1.4 percent respectively.

An 8.1 percent rise in gasoline prices made up about three quarters of the 3.2 percent rise in transportation costs. William Shoemaker, executive director of the Greater Washington-Maryland Service Station Association, observed that wholesale prices for unleaded regular jumped from 94.4 cents per gallon at the start of May to $1.039 at the end of June. Since then the price has dropped a bit. Retail prices are about 20 cents per gallon higher than wholesale costs.

Grocery store prices rose 1.2 percent, the same as in the past two months. Pork, beef, sugar and sweets led the way. On the lower side were poultry, fresh vegetables and cola drinks. The price of alcoholic drinks was knocked back by 0.6 percent. But restaurant meals went up by 1 percent.

Medical costs continued to outpace inflation, jumping by 1.6 percent.