Maryland State Comptroller Louis L. Goldstein asked the U.S. Department of Energy and the Maryland congressional delegation yesterday to investigate whether 15 national oil companies are violating energy regulations by refusing to sell high octane gasoline within the state.

Maryland is apparently the ifrst state to report to federal authorities the increasing shortage of premium gas, said Marvin Bond, an assistant to the comptroller. No one has researched whether that "diminution of services" is allowed under federal energy guidelines, he said.

Meanwhile, state Attorney General Francis B. Burch said yesterday he sees no reason why a service station can't purchase its high octane gas from another company if its own company cuts off the supply.

The 15 oil companies, which supply most of the service stations in the state, announced last week that they would no longer supply their franchised dealers with 95 octane, or premium, gas. Only five companies - Texaco, Sun Oil, Mobil, Gulf and Chevron - will continue to supply their dealers with premium gas, according to the comptroller's office.

The oil companies said the drastic decline in sale of premium gas and federal requirements that they produce more gas from each barrel of crude oil made it no longer profitable for them to manufacture the high octane product.

In Maryland, premium gas sales have fallen from 46 percent of total sales in 1970 to 15 percent recently, according to the comptroller's office.

Bond said the old Federal Energy Administration, the forerunner of the new Department of Energy, ruled in the past that "a lowering of octane level could be construed as a raising of the price." Both price changes and the diminution of servies could violate current energy regulations, Bond said.

In Maryland, 162,000 cars out of the 2 million registered with the Motor Vehicle Administration require high octane gas to run smoothlly.

Burch said his office was taking the position that the public has a right to buy high octane gas and that dealers have a right to decide whether to sell it.

If a dealer's company refuses to let him buy premium gas from another company or if another company refuses to supply the dealer, Burch said dealers should report the incident to the attorney general's antitrust division for investigation.

Burch added that if dealers encounter resistance from their companies when they try to buy high octane gas from another company, "They should not go ahead and sell some other brand of premium anyway.I don't want them losing their leases."