During the last two weeks the average retail price of gasoline rose 2.68 cents a gallon, according to Dan Lundberg, publisher of an industry newsletter that regularly surveys 17,000 service stations nationwide.

Lundberg said the so-called average price--an amalgam of all types of gasoline (leaded and unleaded) sold at both self-service and full-service stations--was $1.2123 on May 21, compared with $1.1855 two weeks earlier.

He said the increase was less than the wholesale price rise imposed on dealers by refiners, indicating that station owners are afraid to pass along the full cost. The wholesale price for gasoline rose 3.31 cents a gallon during the same period, he said in an interview.

On average, he said, a service station charged 9.08 cents a gallon more than it paid for gasoline on May 7, while that margin shrunk to 8.45 cents on May 21.

Lundberg, publisher of a newsletter that bears his name, said that refiners have had to raise prices because a 20-cent decline in wholesale gasoline prices between March 1981 and March 1982 sharply reduced operating margins (the difference between the cost of crude oil and the price at which they sold refined products such as gasoline) at a time when costs of operating the refineries continued to rise.

Furthermore, he said, while many bigger and newer refineries are operating at an efficient level of capacity, many with older technologies (mostly smaller, so-called independent refiners) have been operating well below capacity, increasing sharply the average cost of producing a gallon of gasoline. He said these refiners have to raise prices to keep in business.

In the Washington area, Lundberg said, the average price of unleaded gasoline at self-service stations rose from $1.1549 a gallon on April 16 to $1.1790 last Friday. Most cars on the road today require unleaded gasoline.

The Washington Post reported Sunday that its own survey of 98 self-service prices showed the average price of unleaded gasoline in the Washington area was $1.19 a gallon on May 21. The Post survey found that overall the average price of gasoline has increased 4.4 cents during the last three weeks,

Lundberg said that he expects gasoline prices to rise about another penny during the next week as dealers try to make up some of the "margin" they lost between May 7 and May 21 by not passing along the full amount of wholesale price increases.

Unless dealers are able to recoup, he said, more dealers will be forced out of business. Although figures are not precise, the government estimates the number of gasoline stations in the country has shrunk from about 200,000 in 1970 to fewer than 145,000 today.

Only Pittsburgh and Philadelphia have lower prices today than they did on May 7, according to Lundberg. Market observers said that Arco--the big oil company that stopped accepting credit cards and lowered prices to reflect the savings--has a heavy presence in those two cities.