Transportation Secretary Neil Goldschmidt said yesterday that the venerable federal highway trust fund is now spending more money than it is collecting and that a gasoline tax increase of one or two cents per gallon will probably be needed, beginning next year, to make up the difference.

This is the first time in the 24-year history of the trust fund that it has run a deficit. The fund has been vigorously attacked over the years as the engine that powered an unstoppable road-building machine.

Goldschmidt said he will recommend an increase in the gasoline tax to President Carter as part of a new national highway policy in "the first year of the Carter administration's second term."

Goldschmidt acknowledged, however, that Congress has shown no enthusiasm for a 10-cent-a-gallon increase already proposed by Carter this year and that a gasoline tax increase of any size will never be easy for Congress to approve.

Unless the trust fund is fixed, Goldschmidt said, the Federal Highway Administration will be unable:

To finish the interstate highway system.

To maintain its commitments to assist cities and states with other primary and secondary highways.

To continue a bridge replacement program that is estimated by some to be 10 years behind.

To finance coal roads needed for hauling the nation's most plentiful energy source from mines.

The problems in highway construction and maintenance will be outlined this year in hearings by the transportation subcommittee of the Senate Environment and Public Works Committee under Sen. Lloyd Bentsen (D-Tex)., Goldschmidt said, and a formal administration policy will follow.

"It would take a gas tax increase," he said. Later in a breakfast meeting with reporters Goldschmidt estimated the tax increase at one or two cents per gallon.

Goldschmidt, the former mayor of Portland, Ore., came to the Carter administration with an anti-freeway reputation. He has said repeatedly, however, that the nation must maintain its highway network, which he calls "a trillion-dollar investment."

"We need to provide assurances that before we spend on new facilities," he said, "we will tell the American public that what has been built will be maintained."

The federal highway trust fund keepers have discovered this year what many states had already found in their financial programs: per-gallon gasoline taxes no longer produce enough money.

The federal gasoline tax of four cents per gallon has been in effect for 20 years. The surge in gasoline prices has resulted in a reduction in the number of gallons purchased -- and therefore a reduction in the amount of tax revenue. The gasoline tax represents more than half of the revenue earkmarked for the highway trust fund.The rest comes from taxes on rubber and on heavy trucks and buses.

So far this year, the highway trust fund has collected $5.1 billion in revenues, but has paid out $5.5 billion.

The present trust fund balance is $12.1 billion -- and obligations due from that balance total $14.1 billion. The trust fund is literally in the hole.

A major need, according to Goldschmidt, and a growing number of state highway officials, is more federal money for maintenance programs. The federal trust now cannot be used for maintenace, although there is loophole called "restoration, rehabilitation and repaying" through which some federal maintenance funds flow.But this year, for example, $351 million or 6 percent of total trust fund obligations, has gone for maintenance programs.

Many older sections of interstate highway, plus bridges, plus other primary and secondary roads, need major repairs, which states have deferred because they do not have or will not raise the money for those programs.

The interstate highway system is now officially 93.6 percent open to traffic, at a cost of $76 billion. It is estimated that $28 billion more, for a total of $104 billion, is required to build the remaining 6.4 percent. However, unofficial federal highway estimates push that total much higher -- to at least $115 billion.

Most uncompleted sections of the interstate are controversial urban freeways such as Interstate 66 here, and many may never be built.