The last of the televised debates between Illinois Gov. James R. Thompson (R) and his opponent, state Comptroller Michael J. Bakalis (D), was in its final moments Thursday night. Bakalis had made his closing appeal, and now Thompson, looking as confident as ever, was summing up by contrasting what he called Bakalis' "double-talk" promises to Thompson's record in office.

"And so," Thompson said, triumphantly, "it all comes down to one question . . . Who do you trust to govern the state of Illinois for the next two years?"

Two years. Beautiful. Except for one little thing. Thompson, 41, is seeking a four-year term as governor, but is widely suspected of having his eye on the 1980 presidential race. His Freudian slip seems certain to fuel that speculation and thus feed an issue that Bakalis has done his best to keep alive.

When reporters, in a post-debate news conference, asked what Thompson had meant by the remark, he seemed sgnuinely surprised at his mistake. Then the former prosecutor, whose precise recall of complex facts has always been one of his best weapons in the courtroom or the campaign, said he supposed it was becuase he is just completing a once-only, two-year term, required when the new Illinois Constitution switched gubernatorial elections to nonpresidential years.

"Everbody assumes I'm going somewhere," Thompson said. Where he is going, first, is back to Springfield for another term, but he is not likely to linger there. The passion for the presidency burns as brightly in him as in any politician in the land. And while the debate showed the same proclivity for embarrassing minor mistakes as his first two years as governor, it also demonstrated something more important: Thompson is the kind of politician who is fortunate in his foes.

As U.S. attorney for Illinois in the early 1970s, he had a field day jailing corrupt officials of both parties. When he ran for governor the first time in 1976, the Democrats went through a murderous primary to defeat their own incumbent, and then served Thompson an opponent, Micahel J. Howlett, whose ample girth and verbal gaffes made him seem a parody of a machine hack.

Thompson beat him by 1.4 million votes, an Illinois record, and immediately let people know that he had been dreaming of the presidency since he was 11.

This year, the Democrats seemed to have done better. Bakalis, 40, a former college professor, had won uphill fights to be elected, first, superintendent of public instruction, and then state comptroller. In both offices, he earned a reputation for independence and integrity.

But he has not found the handle on Thompson. Outmeasured 10 inches by the 6-foot, 6-inch governor, and outfinanced by about $1 million, Bakalis has wandered widely, looking for an angle. But Thompson has taken away the support of the teachers and union backing. Liberals are upset at Bakalis for his harping on his disagreement with Thompson's veto of a bill to cut off state financing of Medicaid abortions.

Bakalis has campaigned constantly in business suits, and has derided Thompson for being adolescent in his proclivity for T-shirts, handball and such high-living luxuries as a matched pair of Checker limousines to accomodate his long legs.

In Thursday's debate, Bakalis primly declared that "we will never get our children to respect our leaders until our leaders stop acting like children." He criticized Thompson's taste for good food, good wine and fancy furnishings - which does not seem to worry the voters as much as did the recent illness of Thompson's infant daughter.

Bakalis had his best shot earlier this year, when he lined up support in the Democratic legislature for a tax rebate proposal, which Thompson promptly vetoed.

Nervous about leaving the issue there, Thompson concocted an essentially meaningless advisory referendum for the November ballot, asking whether voters favor constitutional and statutory ceilings on state and local spending.

Bakalis scoffed that it was "Proposition Zero," and had a field day when it turned out that Republican organization officials, under heavy pressure from Thompson to collect almost 600,000 signatures in five weeks, had resorted to questionable techniques for placing the referendum on the ballot. Someone, for example, forged the signatures of the president of the Illinois Bar Association and his wife.

Thompson squirmed in embarrassment, but it has turned out that even Proposition Zero is a benefit. Polls show that his reputation for personal honesty is strong enough that no one suspects him of complicity in the hanky-panky. And the lure of voting - evne in an advisory referendum - for tax ceilings may be enough to bring suburban voters to the polls in what is otherwise a woefully dull political year.

Once again, the opponent is making Thompson look good. Seeing the tax issue turn against him, Bakalis last week-end unveiled a new plan to rebate 20 percent of property tax payments, and said he would not run for reelection in 1982 if he failed to deliver on his promise.

Thompson said the Bakalis plan would either mean severe cutbacks in school funds or higher state taxes, but Bakalis said the four-year cost of $360 million could be financed from funds Thompson is wasting.

In the head-to-head debate, Thompson repeatedly asserted - and Bakalis just as often denied - that the full cost of implementing the Bakalis plan would be at least $1 billion for four years, and possibly $2 billion. He said Bakalis' press secretary had comceded that to reporters - a statement Bakalis also denied.

When the cameras were turned off, and reporters questioned Bakalis, he quickly conceded that the cumulative cost of his program would be $1 billion and the original estimate had been wrong. He said he disputed Thompson on the air because "I didn't understand what he was saying."

What once appeared to be a race that was moving into the possible upset category is beginning to look like another Thompson landslide. Two public polls in the past four weeks have given Thompson a 2-to-1 lead.

But the governor , who has other objectives than just getting back to Springfield, is worried about how his victory margin will be interpreted.

In an interview, he noted, accurately, that Illinois governors rarely win reelection by a wide margin. The last three who tried for second terms have been defeated. "The biggest margin in modern times, I think was about 179,000 votes [citing the late Otto Kerner's 1964 plurality with asbolute accuracy], so it's hardly realistic for anyone to think that I can win by 1.4 million votes again," Thompson said.

Then he made his worry explicit: "If I win by 750,000 votes, while Percy and Scott win by 1 million or more, the national columnists will say I'm through."

Sen. Charles H. Percy (R) and state Attorney General William Scott (R), both blessed with lackluster, under-financed opponents, are expected to run ahead at Thompson - a prospect he plainly does not relish.

In March 1977, when he had been governor only two months, Thompson told a group of Washington reporters that, if he decided to try for the presidency in 1980, he could "run hard" in the primaries even while serving as governor.

"A governor doesn't run the state, day to day, from his desk," he said. "That's what the cabinet and the bureaucracy are for."

Asked last week if he still felt that way after 21 months in office, he said yes. "Running for president would be difficult, but not incompatible" with being governor, he said. "I've been in my Springfield office only five minutes in the last two weeks, and I've not neglected my job. A lot of it is paperwork and that you can do on the plane."

Thompson said he would "travel a bit to other states in 1979, but I'm not going to be in a frantic rush. I want to look at what's going on beforeI make any decisions to plunge in."

He could hardly hope of find opposition for the presidency as inept as that has faced in Illinois. But then again, given his luck, maybe he will.