President Reagan ventured into the heart of conservative Virginia today to deliver a rousing attack on the "liberal Washington establishment," and cast this fall's congressional elections as a national referendum on his economic policies.

Speaking to 3,500 cheering partisans in a flag-bedecked wrestling arena here, Reagan called for the election of Republican Rep. Paul S. Trible to succeed retiring Sen. Harry F. Byrd Jr., an independent. "You have a 50-year tradition in Virginia that crosses party lines," the president said, citing the five decades that Byrd or his father has sat in the Senate. "The best way to continue that tradition on beyond 50 years is to send Paul Trible to the U.S. Senate."

The president's speech marked his first stop on a 10-day campaign offensive aimed at bolstering Republican candidates whose support has been eroded by discontent over Reagan's economic policies and the nation's highest unemployment in 41 years.

The fall elections, Reagan said today, offer a "clear choice about the kind of nation we will be -- whether we will continue our sure and steady course to put America back on track or whether we will slide backward into another economic binge like the one which left us with today's pounding, national hangover."

Virginia Republicans were optimistic that Reagan's appearance boosted Trible, a 35-year-old Newport News congressman who is locked in a virtual dead heat with Democratic Lt. Gov. Richard J. Davis.

A recent statewide poll found that Reagan, whose support has slipped elsewhere, is still popular in Virginia, where voters approved of his administration by a 49 percent to 40 percent plurality.

Alfred Cramer, the state's Republican Party chairman, called Reagan's visit "a shot in the arm" for the Trible campaign. State GOP headquarters had distributed thousands of free tickets to area schools and party loyalists, such as Louise Picardat, an elderly Richmond woman who showed up with a pair of friends "because we're crazy about Ronald Reagan.

"He's doing the best job he can," she said. "Like he said on the television last night, there are thousands of jobs in the newspapers for anybody who wants them."

Reagan's speech continued the theme he began in a Tuesday night press conference and today he added some of the toughest rhetoric he has used against his Democratic critics.

Their "decades of overindulgence," he said, were the cause of the country's economic ills and an unemployment rate expected to hit 10 percent next month.

"It seems to me that the people who created the mess we're in -- the same politicians who took us down the path of guaranteed economic disaster -- are the last ones who should be delivering sermonettes on the cause of unemployment," Reagan said.

Following a spirited welcome by high school bands and sequined baton twirlers and pompon girls, the president took the podium for a speech that contained a few gaffes. He confused former Republican governor John N. Dalton, who was sitting behind him, with Sen. John N. Warner, who was not present. Later, he declared that his presidency had begun on Jan. 20, 1980 -- a year before his inauguration.

At least one heckler was forcibly ejected and later charged with a breach of the peace after he attempted to read aloud a lengthy statement during the president's speech. A group of schoolboys drowned the protester's remarks with chants of "U-S-A, U-S-A."

"Aren't we happy we live in a country where somebody can dissent?" Reagan said, adding: "Of course, I'd like to have a chance to convert them."

Besides energizing Trible supporters, Reagan served as lure at a private $500-a-ticket roast beef and wine reception at a Holiday Inn that attracted more than 100 party notables. Among them were last year's defeated gubernatorial candidate J. Marshall Coleman, now a Washington lawyer, as well as some of the state's conservative, independent business leaders such as former Peterburg legislator W. Roy Smith and Richmond investment banker J. Smith Ferebee.

The Richmond reception was followed tonight by a major Trible fund-raiser at Washington's Sheraton-Carlton Hotel geared as business political action committees.

Trible Press Secretary Neil Cotiaux said events of the day were expected to bring in $155,000, including about $100,000 from the Washington fund-raiser, to which 200 PAC representatives were invited.

Reagan also used the Richmond visit to shower some election-year largesse on the state, announcing a $125,000 grant for Hampton Institute, one of the state's predominantly black colleges.

Trible's Democratic opponent, Lt. Gov. Davis, has spent much of his campaign attempting to shed a liberal image and had avoided direct attacks on Reagan's administration. "He's my president as well as my opponent's president and everybody else's," Davis, a 61-year-old mortgage banker, has said.

Rather than make any remark that might be construed as critical of today's rally, the Davis campaign issued a statement welcoming Reagan.

"It's always an honor when the president of the United States visits Virginia," said Davis spokesman Will Marshall. "As was the case in last year's gubernatorial contest , we don't think a brief visit will affect the Senate campaign."

A key Davis strategist last night confirmed that the Democrats were seeking to avoid direct combat with Reagan. "Who would you rather run against -- Paul Trible or Ronald Reagan?" he asked.

Today's event was what the GOP's Cramer described as "an old-fashioned political rally." Flying by helicopter to Richmond's Parker Field, home of the minor league champion Richmond Braves, Reagan was met by supporters carrying placards that read "Come on, Ron," and "Reagan Is Number One."

The front rows of the auditorium were jammed with exuberant high school students, who leaped and shouted on cue, and gleefully popped hundreds of the red, white and blue balloons that showered from the ceiling after Reagan finished speaking.

It was a particular thrill for youngsters such as 10th grader David Ammons, a trumpet player from Thomas Dale High School in suburban Chester. "I was nervous," Ammons said. "We practiced real hard -- five times."