John B. Anderson, the Swedish immigrant's son from Illinois, brought his independent presidential campaign to an emotional and poetic end tonight before thousands of cheering students at his old alma mater.

"Tonight is an end in one sense," he told a thundering crowd at the University of Illinois, his voice cracking with sentimentality. "Yet I find myself thirsting for tomorrow. And I will celebrate on the morrow for this great feast of democracy.

"For whatever the outcome [of the election] our goal has been to wake up America and bring a new sense of hope in the future of our country," continued Anderson, who wore a tie with the university colors, orange and blue. "You give me the heart to believe that in the hearts of young Americans we have succeeded."

It was an ending laced with symbolism, one more fitting a poet than a politician. Throughout his long and difficult campaign, Anderson has found his largest and most enthusiastic crowds on the nation's campuses. He returned here hopelessly behind in the polls, insisting his election was still "not just an impossible dream."

He had kept up the same facade of confidence for the last three days. But when he arrived on the campus here, where he received his undergraduate law degree, Anderson turned introspective, summing up his campaign and reminiscing about old professors. He quoted Tennyson: "How dull it is to pause, to make an end."

His homecoming crowd was the loudest of the year. The 2,000-seat university auditorium was packed. Hundreds more students listened outside. The students stomped. They shouted "JBA, JBA, JBA." They threw confetti. tThey waved balloons and placards.Anderson said his campaign should be judged "not simply by the cold statistics of public opinion" but by what he had tried to accomplish.

Although his mood was extremely upbeat, the tone of Anderson's words seemed different than they had been earlier in an appearance in Minneapolis.

Standing hatless and without an overcoat before a crowd of more than 4,000 at the University of Minnesota, Anderson urged students to ignore pleas from the Carter campaign that a vote for his independent candidacy is a wasted vote.

"What they are counseling is that out of fear you should submerge your real feelings," he declared as a brisk wind blew through his snowy white hair. "I urge you not to vote for the lesser of two evils, or as one man told me in the Northwest, for the evil of two lessers."

As he spoke, Anderson could see scattered placards in the large and enthusiastic crowd outside Northrup Auditorium that read: "John, Don't Give Us Reagan," Four More Years of Fritz," and "Free the Anderson 7 percent" -- a reference to his standing in the latest Gallup Poll.

"I'm not afraid of the judgement of the American people on the morrow because in the final solemn act, when the curtain is pulled on the voting booth, in that final ultimate moment of truth, away from the noise, the hoopla and the sloganeering . . . I believe there will be a flash of reality," he told students here.

"I don't think that it is just an impossible dream," he added, "you can help it come true by spending time today and tomorrow calling your friends, canvassing the neighborhoods where you live, telling the American people that we can have an Independence Day not only on the Fourth of July, but we can have an Independent Day tomorrow."

A baffling transformation has occurred in Anderson in recent days. He has become almost euphoric.

This morning he called his campaign "the most exhilarating experience of my life . . . an adventure." His running mate, former Wisconsin governor Patrick Lucey, called it a "great adventure . . . an enterprise of faith."

Later, at his final campaign press conference, Anderson was given a whistle by Houston Hall, an NBC cameraman who for weeks has been selling whistles on the campaign plane. "How much have I enjoyed this campaign?" Anderson asked. He raised the whistle to his lips: "Whee-ee-oo -- oo-ee."

Anderson's attacks on Reagan and Carter have turned almost completely to humor in these last days of the campaign. He told students here, for example, that he understands why Jimmy Carter said that "Amazing Grace" is his favorite hymn. "It would take amazing grace on the part of American people to forgive for what he's done to the country."

As for Reagan, his theme song, "would have to be some hymn approved by the Moral Majority. It would have to be 'Sweet Bye and Bye' because that's where he is -- in the sweet bye and bye."

Anderson is ending his campaign, which has taken him more than 100,000 miles since April, convinced that his candidacy has given voters a real alternative, and laid the groundwork for a major transformation of the political system. He acts almost like a martyr whose cause has been vindicated.

Lucey, making a rare joint appearance with the Illinois congressman, added to that feeling today. "He stood up for what he believed in," Lucey said at the University of Minnesota. "He has refused to be collared in. He has refused to bend before conventional wisdom. He has refused to retreat in the face of adversity."

"John Anderson has shown guts in this campaign," he added, passionately. "Now it's your turn."

Anderson said he plans to vote a split ticket Tuesday, but the only race that he would elaborate his feelings about was that for the Illinois Senate seat now held by Alai Stevenson, who is retiring. Anderson, a 20-year Republican member of the House, said he intends to vote for Democratic Secretary of State Allen Dixon because of Republican Lt. Gov. David O'Neal's opposition to the Equal Rights Amendment.

Anderson, in replying to reporters' questions at a press conference, also continued to drop hints that he's looking beyond Tuesday in his political career.

"I don't care what these poll figures show. There are thousands and thousands of energetic, dedicated people from one end of this country to another who have contributed almost $10 million, who put us on the ballot in each of the 50 states, these people aren't just going to shrivel up and die . . .. We have kindled genuine interest in what we've tried to do. . . . There will be some enduring contributions of the effort Gov. Lucey and I have made."

After the evening rally at the University of Illinois, Anderson returned to his home town of Rockford, Ill., where he intends to vote early Tuesday before returning to Washington.