President Reagan's announcement yesterday that he supports a gasoline tax increase climaxed a long campaign by Transportation Secretary Drew Lewis to recruit support for his belief that money must be found to rebuild the nation's highways, bridges and transit systems.

The campaign started almost 22 months ago, when Lewis took office, and gained strength (despite two false starts) as business interests joined the traditional state and local lobbyists in recognizing Lewis' prime tenet: if they all jumped on the same bandwagon, it would someday become irresistible.

Yesterday the president joined them when he announced his total support for a 5-cent-a-gallon increase in gasoline and diesel taxes.

It was the biggest of a series of victories for Lewis, who now must be regarded by government observers as the most successful DOT chief in the relatively short history of the department created by Lyndon B. Johnson in 1966.

"The third time's a charm," a jubilant DOT official said yesterday.

Lewis expected to lose the first time. He was a little bit down the second, but had noted before then that "maybe if we don't get it this time we will have laid the groundwork to get it next time."

That is just what happened. After this month's elections, the gasoline tax increase proposal that Lewis had pushed for almost two years became on Capitol Hill a program to create jobs.

New highway and transit legislation has already passed the House Public Works Committee, so a few amendments would make it easy to appear to be doing something quickly about unemployment during the lame-duck session beginning Monday. The House and Senate leadership endorsed the plan this week.

Lewis himself is no fan of public jobs programs and had carefully sold the gasoline tax increase at the White House as a user fee to help solve a visible problem--crumbling highways and bridges. Perhaps 320,000 jobs would be created, however, Lewis noted.

The federal highway trust fund is about to go out of business and new legislation is needed to extend it. The gasoline tax has remained unchanged since 1959. A combination of rapidly increasing highway costs and stabilized gasoline purchases means the tax has produced dwindling revenues. For the last three years, the trust fund has spent more than it has taken in.

These facts were well known. The problem Lewis had was keeping interests usually involved in highway legislation from fighting with each other so he could present a unified front.

The classic confrontationalists are the transit and highway interests.

They battled mightily on highway bills in 1974 and 1978, with transit backers seeking to "break the trust fund" and highway lobbyists fighting to hold their gasoline tax and other revenues.

This time, Lewis proposed a package that had something for both, then persuaded the highway lobby to support transit and the transit lobby to support highways.

The truckers have even been willing to go along with the increase in the gasoline tax, although there remains a major argument with Lewis over his proposal to substantially increase the weight and tire taxes that heavy trucks pay.

If everybody hangs together, Lewis strongly implied, he would push hard for the bill in the administration. If there was a falling out, it would be harder. Almost everybody got the message.

Lewis has worked closely and effectively with Congress, not only the Republican Senate, but also the Democratic House.

He meets weekly with such House leaders as Rep. James. J. Howard (D-N.J.), chairman of the Public Works Committee and the principal author of the highway and transit legislation now pending in the House.

Howard was happy to hear about the president's action yesterday, but said, "We've been ready since May. Basically I think our bill is just fine."

Lewis also lined up the business community. He scheduled a series of meetings with business groups and wrung an endorsement from the Associated General Contractors, whose president, H.C. Heldenfels, hustled out a statement yesterday expressing his thanks to President Reagan for his wisdowm in recognizing the need to "protect our transportation network."

Lewis had trouble disguising his own happiness over Reagan's announcement. "I think the president made the right decision," Lewis said. "This is a need that I've sensed; I felt it was something that had to happen."

Lewis said he expects to be very busy in the next three weeks writing the administration's bill, which will differ somewhat from Howard's, then working it on the Hill.

Lewis' previous victories include:

* an agreement that placed voluntary quotas on Japanese automobile imports;

* legislation setting up user fees to pay for the new air traffic control computer system;

* a pay raise for the air traffic controllers who worked after most unionized controllers were fired for striking;

* a schedule that could make it possible for Conrail to become a profitable, privately owned railroad once again;

* the first-ever adopted policy for Washington National Airport.

Also pending in the lame-duck session of Congress is major maritime reform legislation.

There have been numerous rumors that Lewis was bored or looking for another position in the administration, but he has denied them on several occasions. The most recent rumors have Lewis taking a private-sector job sometime in the next year.

"There's still a lot to do in transportation," he said yesterday. " . . . I expect to be around."