Consumer prices, led by sharp increases in the cost of gasoline as well as rising food prices, rose 0.4 percent in August, a moderate increase that should keep the economic recovery on track, the government said yesterday.

Consumer prices moved up last month by the same amount as they did in July, bringing the inflation rate as measured by the Consumer Price Index to an annualized growth rate of 5.3 percent, the Labor Department said.

The increase carried the index, which is based on 1967 prices, past the 300 level, to 300.3, which means that prices have tripled over the past 16 years. A basket of goods that cost $10 in 1967 would cost $30.03 today.

For the first eight months, the CPI rose at a 3.4 percent annual rate, and it is expected to be up by between 4.5 and 5 percent for all of 1983.

Despite the moderate increase in consumer prices in August, some economists are now revising upward their forecasts for inflation next year, based partly on the surge in money growth allowed by the Federal Reserve Board in the nine-month period ended in June.

Other economists, who said part of the low rise in inflation this year is due to slow increases in wage rates, said that with the economy improving, wage demands could start to grow. In addition, food prices are edging upward because of the summer drought.

"Now, many analysts feel that wage restraint is about over," said a monthly report of the Morgan Guaranty Trust Co. of New York. "The consensus is that wage rate increases will soon start climbing and could reach a 6 percent pace next year."

However, there is still 9.5 percent unemployment and room for growth in the economy before wage rates should start to rise, economists said.

White House spokesman Larry Speakes said the consumer price figures show "inflation remains under control. This puts inflation for the last 12 months at 2.6 percent, a very encouraging sign for interest rates."

Food prices were "better than expected," Speakes said. "Keeping inflation down is a major part of keeping recovery on track. Today indicates we're on course."

Private economist Andrew Brimmer agreed. "We're about on track for inflation right now," said Brimmer, a former member of the Fed. "All of 1984, the rate will be about what it has been," which is about 5 percent. "I'm not in the crowd that says 6 to 7 percent. I see nothing to justify such a forecast."

Commerce Department chief economist Robert Ortner said that inflation is proceeding "a little bit faster than what we had some months ago," but maintained that price increases are not worrisome to the administration. "It's possible inflation will pick up in the future, but not more than 5 percent in 1984."

Meat prices, as expected, were down last month because many animals were slaughtered as a result of the summer's drought, which ruined crops and consequently led to sharp feed-price increases. However, many economists said those improvements could be short-lived, as meat shortages arise in the coming months.

Vegetable prices, also affected by the drought, jumped 5.8 percent last month after rising by 0.3 percent in July. Fresh fruit prices dropped 2.1 percent.

Wholesale prices at the bottom of the food chain for such items as grains and other staples shot up nearly 4 percent in August, which means that grocery shoppers will soon begin to see higher food costs this fall and winter as these increases are incorporated into the prices of finished goods.

Prices for new cars shot up 0.8 percent last month after no increase in July, and used-car costs soared 1.8 percent in August after climbing 1.5 percent the previous month.

The cost of gasoline jumped 1.1 percent last month after rising by only 0.4 percent in July. That was partly because motorists drove more during the summer, Brimmer said.

Medical care prices climbed 0.5 percent, about the same as in the past five months, and housing costs rose 0.2 percent. Clothing prices increased 0.2 percent, compared with a drop of 0.1 percent in July.

Moderate increases in fuel oil and water and sewerage costs were partially offset by declines in costs for electricity and natural gas, the Labor Department said.