Gulf Oil Corp. has been cleared of federal allegations that it overcharged Virginia Electric and Power Co. by about $2 million for fuel oil purchasers during the mid-1970s, the Department of Energy announced yesterday.

Energy Department officials said they have withdrawn an order issued by the Federal Energy Administration in 1976 that would have requred Gulf to refund $2.2 million to Vepco - an amount representing the alleged overcharges and interest payments. Vepco had planned to pass the refund on to its customers.

"They [Gulf] were right. We were wrong," Phillip Kalodner, general counsel for DOE's Middle Atlantic office in Philadelphia, said in a telephone interview yesterday.

The agency's announcement followed a series of complex administrative and court proceedings, during which Gulf contested the government allegations. Vepco never determined how large a rebate its average customers might have received if the fuel oil refund were requred, but a Vepco spokesman said yesterday it would have been a small amount - "considerably less than a dollar on a customer's bill."

In an unannounced decision, DOE officials reversed themselves April 13 and accepted an interpretation of fuel oil regulations supported by Gulf and other oil companies, officials said yesterday. The Energy Department then rescinded the order issued against Gulf. On Friday, a lawsuit brought by Gulf to challenge the government order was dismissed by a federal judge in Philadelphia.

A Gulf spokesman said yesterday the DOE decision vindicated the company's contention that it "didn't overcharge," but he added that Gulf is still considering appealing the dismissal of its court challenge. Such an appeal, the spokesman said, would be intended to secure a court ruling supporting the revised interpretation of DOE regulations and to head off possibile suits by Gulf customers.

At issue in the dispute between DOE and Gulf was a federal regulation that required Gulf to sell fuel oil to Vepco at prices based on those existing on May 15, 1973. Vepco purchases fuel oil for use in its electric power-generating plants.

Officials of FEA, the Energy Department's predecessor, at first had contended that the fuel oil prices Gulf charged Vepco should be governed by a contract that existed between the two companies from July 1, 1972, to June 30, 1973.

Gulf argued that the prices, instead should be regulated by a contract that was signed on May 10, 1973 - five days before the end of the period specified by law as the basis for setting rates. The May 10, 1973, contract, however, did not go into effect until July 1, 1973.

Eventually, DOE officials decided that Gulf's interpretation - which permitted it to charge Vepco higher prices - was correct. "We were wrong. The appropriate interpretation was to give the company the benefit of the new contract, even though [it was] not in effect [on May 15, 1973]," said DOE counsel Kalodner.