Against the backdrop of a flag-bedecked $340 million nuclear attack submarine, Virginia Republican Rep. Paul S. Trible beamed while a top Navy official touted his candidacy for the U.S. Senate.

"We need the articulate voice and effective leadership of Paul Trible in the United States Senate," proclaimed Assistant Secretary of the Navy George A. Sawyer, before a cheering crowd of 4,500 here recently.

The launching of the new submarine, the Salt Lake City, was part of a gala celebration -- complete with a blaring Navy band and 18,000 red, white and blue balloons blown up by local Boy Scout troops -- that was engineered by the sub's builder, the mammoth Newport News Shipbuilding and Dry Dock Co. It was one of the several ways Newport News Ship, Virginia's largest private employer, and its principal customer, the U.S. Navy, have plugged Trible in his tight race against Democrat Richard J. Davis.

Trible's relationship with the shipyard and the Navy is, in fact, a classic example of what some call the "iron triangle" of political, business, and military interests that frequently underlies campaigns for Congress in Virginia. From the moment he entered the House in 1977, the energetic Newport News congressman shaped his career around catering to shipyard interests, staunchly advocating higher military budgets, naval rearmament, and shipbuilding legislation on the House Armed Services and Merchant Marine committees.

Now that he is running for higher office, his work for Newport News Ship is a major campaign theme. Trible tells voters he has been a "principal architect" of the Reagan administration's naval shipbuilding program and seeks credit for funding the Nimitz-class nuclear aircaft carriers and Los Angeles-class nuclear submarines that have brought billions of Defense Department dollars into his district.

"They're building those ships today and I'm responsible for it -- and thousands of Virginians are at work because of it," Trible told a debate audience in Richmond last week.

Democrats -- and many congressional staffers -- dismiss such claims as wildly exaggerated. "It's beyond me how a press-release, junior congressman can singlehandedly take credit for rebuilding the U.S. Navy," says James Carville, Davis's campaign manager.

Trible nonetheless reaps the dividends. Contributions from political action committees representing military contractors, shipbuilders, and other maritime and defense-oriented interests have poured into his campaign coffers -- $56,000 by one count, including $10,000 (the legal maximum) from the PAC for Tenneco Inc., the Houston-based conglomerate that owns Newport News Ship. (Edward J. Campbell, the shipyard president, has pitched in another $1,000 on his own.)

Equally important, neither the shipyard nor the Navy has missed an opportunity to boost Trible's candidacy. Last week, Navy Secretary Navy John Lehman acted on a longstanding request to name an attack submarine being built at the shipyard after the City of Newport News.

Bypassing the state's senior senator, Harry F. Byrd Jr., the Navy went straight to Trible, whose office promptly made the announcement back in the district, once again winning him front-page coverage in the local press.

"It was highly political," grouses Byron Charleton, staff representative for the pro-Davis United Steel Workers local that represents the shipyard's blue-collar workers. "It seems very apparent that Trible's getting all the fanfare so he can take the credit for all the work that comes here."

Yet Trible's friendships with Newport News Ship and the Navy are hardly unusual for a Virginia congressmen. Democrat Thomas M. Downing, Trible's predecessor in the House, recalls that his 18-year Washington career was governed by a simple philosophy: "Anything that was good for the yard was good for the area and that was really good for the nation."

The arithmetic of shipyard politics is simple enough. The yard itself is a 475-acre jungle of giant cranes, girders and work sheds that sprawls for two miles along the James River shoreline. Some 25,000 workers file behind its iron gates every day. An estimated 80 percent of its $1.1 billion in sales last year went to the Navy.

"It's the most important economic interest of its kind in the South," says Trible.

Trible has ceaselessly cultivated that interest in a variety of ways. During his first campaign for Congress against former Democratic state Del. Robert Quinn, Trible would show up at the shipyard gates once a week for the 6:30 morning shift. Campaigning at the gates is an old tradition in Newport News, but Trible was more diligent than most. "Quinn probably did it three times, while Trible did it 25 times," recalls Robert Weed, a Trible strategist who managed the 1976 campaign.

Once elected, Trible first made his mark by protesting the Carter administration's decision to shift the overhaul of the aircraft carrier Saratoga from Newport News to the Philadelphia Navy Yard. Trible worked closely with an army of Tenneco lobbyists in fighting the battle, obtaining internal Navy documents under the Freedom of Information Act, sponsoring floor amendments in the House and filing a lawsuit attempting to block the transfer. Rep. Joshua Eilberg (D-Pa.), the leader of the Philadelphia delegation, accused Trible of fronting for a "high-pressure campaign by Virginia business interests to turn the Saratoga contract into a three-ring political circus."

Trible ultimately lost the battle, but won the war. Once the Reagan administration took office in 1981, it launched the most massive naval buildup since World War II, proposing to spend $96 billion during the next five years to achieve its goal of a 600-ship navy. Part of that will include two more 95,000-ton Nimitz-class carriers, at a price tag of $3.4 billion apiece -- contracts that are destined for Newport News since it is the only shipyard in the country big enough to build them.

As a result, business is booming here. The shipyard confirmed last week that it will be hiring another 1,000 workers next year and as many as 2,000 more in the years that follow. Reagan's buildup may be chiefly responsible, but a recent sampling of workers here found many who are willing to give Trible the credit.

"There would be a whole lot of people out of work today if it hadn't been for Paul Trible," said Nick Nicholas, a shipyard clerk who has been here 15 years.

"I'll never get tired of hearing about Paul Trible," adds Robert P. Smith, a 29-year-old technical planner. "You'll see him at the shipyard even when he's not campaigning . . . And I don't think anyone will ever forget what he did on the Saratoga."

That kind of support for a Virginia conservative is not out of line at the shipyard; for years, its blue-collar workforce used to be represented by the Peninsula Shipbuilders Assocation, which would routinely endorse the likes of Harry Byrd and former Gov. Mills E. Godwin.

After a bitter campaign four years ago, the more activist Steelworkers union became the bargaining agent for most shipyard workers. Now, union leaders, closely aligned with the Democratic party, have endorsed Davis and are distributing leaflets at the gates criticizing Trible for such "anti-worker" votes as cutting funds for the Occupational Safety and Health Administration and supporting Reagan administration economic policies.

Newport News, as Trible is fond of saying, is a place where Reagan's presidency has been an economic blessing. "I'll get get 80 per cent of those that vote here," he said confidently at the shipyard the other day. "They know me. They have confidence in me."