Gulf Oil Corp. yesterday vigorously denied allegations that it overcharged consumers $577.9 million over the past six years, hinting that it believes the charges are politically motivated.

The Energy Department on Wednesday accused seven oil companies, including Gulf, of $1.7 billion in overcharges over six years.

The charges come at a time when the Carter administration is asking Congress for oil price decontrol coupled with a "windfall profits" tax, and Gulf Vice President J. Hill Bonin Jr. made it clear yesterday that he sees a connection.

"It's a very opportune time for the Department of Energy to make these allegations," he said.

Afterward, a DOE official called the suggestion "totally untrue. The timing of the overcharge announcement was entirely a function of when material was ready."

Aside from Gulf, DOE special counsel for compliance Paul Bloom said Wednesday, Texaco, Standard Oil Co. of California, Atlantic Richfield, Marathon Oil, Standard Oil Co. of Indiana, and Standard Oil Co. of Ohio had improperly sold certain kinds of oil for nearly twice the price permitted under DOE regulations.

"We dispute their allegations," Bonin said.

Speaking at a press conference in Gulf's executive offices here, Bonin said Gulf would appeal DOE's administrative complaint and, if necessary, go to court to fight the repayment of $577.9 million.

Gulf contends that of the $577.9 million in alleged illegal charges, only $186 million involved fields that DOE auditors had reviewed up through the end of 1977. The remainder of the alleged overcharges, except for $73 million in interest DOE hope to reclaim, Bonin said, results from extrapolations.

Bonin characterized the DOE claims as "speculative, assumed, overcharges."

At the Energy Department an official familiar with the overcharge investigations said, "Gulf knows very well the extent of the audits using their records, and transaction documents." The official added that 70 percent of Gulf's transactions dealing with higher-priced domestic oil were reviewed, saying that the department's allegations were based on "perfectly routine auditing practices."

DOE's 140-page complaint against Gulf cites instances where the Pittsburgh-based company allegedly had improperly classified oil properties to earn higher profits. DOE alleges that Gulf sold oil from "old oil" properties at more than twice the proper price, rather than the approximately $5 to $6 a barrel the company is entitled to under Energy Department regulations.

The department complaint cover alleged overcharges from the 1974 oil embargo through last March.