Rep. Goodloe E. Byron (D-Md.) is a practical politician.After he was nearly upset in the Democratic primary two years ago by Dan Rupli, a little-known lawyer who accused him of being soft on pollution. Byron perceived that his vulnerability stemmed from his membership on the House Commerce Committee, which is the focal point for environmental legislation.

"So I went to the leadership and told them I wanted off," Byron admitted. "it was a no-win situation" for someone who represented an area as diverse as Maryland's 6th Congressional District, which includes self-consciously liberal Columbia and industry-starved Appalachia.

Byron believes strongly that a member of the House of Representatives should reflect what he believes to be the majority view of his constituents, but he was unable to satisfy, the competing interests of environmentalists in suburban Columbia and Baltimore and the workers and employers in coal-dependent Western Maryland. He also blamed his membership on the Commerce Committee for being taged one of the "Dirty Dozen" congressman targeted for defeat two years ago by Environmental Action, a lobbying group.

So he traded the relative seniority (13th ranking) on Commerce for the obscure safety of 24th ranking Democrat on Armed Services, an action that Rupli contends was crowdly and irresponsible.

Byron, 49, acknowledges also that he has shifted his voting record from right to center to more accurately reflect the changing character of his district. From an earlier House career that prompted one chronicler to mark him as "the most conservative congressional Democratic from outside the South," Byron now finds himself nearly on dead center of the political spectrum.

Rupli, 35, rejects Byron's finge-to-the-wind approach to legislation, contending, that any change in Byron's voting record has been largely "cosmetic."

Rupli also believes that Byron "seriously misjudges the district" as the result of using his franking privilege to mail questionnaires to residents that "ask loaded questions that produce predictable responses that confirm his own view of the world."

Byron admits that Rupli's vigorous campaign two years ago "caught me by surprise." The incumbent recalled that Rupli accused him of failing to respond to sensitive issues such as high electric rates and environmental problems and further admits "that may well be true."

Rupli also charged that Byron ignored constituent problems, and Byron conceded, "yes, I've had some complaints about not enough contacts." So Byron opened field offices and held a series of town meetings.

Byron responded to Rupli's accusation that he turned his back on his plea to help fight fuel adjustment charges during the oil embargo four years ago by introducing federal legislation last year that would outlaw those charges.

Despite Byron's movement toward the middle-of-the-road. Democrats in the 6th District still have plenty to choose between Rupli and Byron, a situation that is in marked constrast to Maryland's seven other congressional districts, where incumbents generally face little or no opposition in the Sept. 12 primary, and, with one or two exceptions, not much more of a battle on November.

The state's three incumbent Republican House members, Robert E. Bauman in the 1 st; Marjorie S. Holt in the 4th and Newton I. Steers Jr. in the 8th are unopposed for renomination in the GOP primary.

The four other Democratic members of the Maryland House delegation face what many observers consider to be token opposition in their primaries, from either perennial challengers or newcomers: Rep. Clarence D. Long from Howard S. Gates in the 2nd; Rep. Barbara A. Mikulski from Morgan L. Amalmo in the 3rd: Rep. Gladys Noon Spellman from Davis J. Tomasin in the 5th, and Rep. Parren J. Mitchell from Edward J. Makowski in the 7th.

Likewise, the winner of the Byron-Rupli primary next month appears to be a shoo-in against candidate Melvin Perkins, who is unopposed for the Republican nomination.

Byron told about 18 people who attended a coffee for him in rural Peterville last week that except for "two or three times a term," he will never knowingly cast a vote that is out of step with the majority of his constituents.

Voting the way his constituents think, rather than forcing a personal philosophy on them, Byron said, is something he learned from his father, William D. Byron, who served the same district in Congress from 1939 until he was killed in an airplane crash in 1941. (His Mother, Katherine E. Byron, served the remainder of her husband's second term, but did not seek re-election.)

In 1940, his father voted in favor of Iend-lease, although it was not the sentiment of the district, Byron told supporters the other night, because "he was looking down the road." It was that same motivation that caused him to vote for the Carter administration's energy package, he said, explaining that while most of his constituents probably opposed all or part of it, if each aspect had to be considered separately, "we'd never get any energy bill."

Rupli mentions Byron's heritage, which also includes a great-grand-father who was a U.S. senator from Maryland, as often as Byron does himself, to draw a distinction in their backgrounds.

"I'm a product of working class people," Rupli told two-dozen people who met with him in the basement recreation room of a supporter's home in Catonsville. The Byrons are the employers and we are the working folks," added Rupli, whose father is a Silver Spring printing salesman.

Rupli gives the impression that his candidacy was thrust upon him after he became "a folk hero, a Nader type" for leading a consumer revolt against soaring utility rates at the height of the 1974 oil embargo.

He said he and his wife, Brenda, their children, Randy, 17, Andrew, 10, and Erika, 7, had agreed to "adjust our lifestyle" even before the crunch hit, lowering the thermostat, turning down the water heater, taking fewer trips and even exchanging aluminium foil for wax paper.

When their electric bill tripled, despite the cutbacks, Rupli founded the Organization for Consumer Justice, and attempted to enlist the aid of public officials, only to discover that Byron was "a patsy for energy interests, supporting depletion allowances, deregulation . . . he was no damned good."

After he determined that sky-rocketing energy costs were a "political problem," Rupli said he looked around for someone to challenge Byron, only to have people tell him that Byron was "invincible."

Rupli did not buy that, believing that Byron was "known by his name only, not by his voting record." So with little money and even less organization, he challenged the incumbent and attracted 45 percent of the vote in the 1976 Democratic primary.

Byron is not going to again be surprised by Rupli this year. He has hired a full-time campaign manager, John Bass, opened five campaign headquarters throughout the 175-mile wide district and is planning to spend $100,000 or more to retain its seat. Two years ago, Byron spent $26,000, and before that, "hardly anything" in rolling up 70 percent-plus margins. Reporters who wanted to cover his campaigns, and there were not many, "had to come see me at the Capitol," Byron said.

Rupli's campaign also is more sophisticated this year. In 1976, he was so confused about the district's jaged boundary lines that one day he campaigned in Rep. Clarence Long's 2nd District in suburban Baltimore, and another time was handshaking on the wrong side of a bridge over the Potomac, in West Virginia.

Fueled by campaign contributions from organized labor ($21,245 of $28,212 he raised through July 1 came from unions, according to records at the Federal Election Commission), Rupli is whistle-stopping in a pickup truck on which he has constructed a mock railroad caboose, in imitation of Harry Truman's famous 1948 campaign.

While Byron's campaign manager, Bass, points out that "most of Rupli's money is from out-of-state." Rupli said, "I welcome labor's support and money." His campaign manager, Tom McLaughlin, added, "Labor money is as close to clean money as you can get, I wish we'd get three times as much of it."

Rupli counters by pointing out that Baltimore Gas & Electric, the state's largest utility, contributed $1,000 to Byron in a campaign in which "energy is the No. 1 issue." (Other large donors to Byron, who raised $78,594 through July 1, according to federal records, were the American Medical Association and its Maryland chapter, $4,600, numerous corporate political action committees, lawyers, executives and real estate interests.)

Byron resents the "Dirty Dozen" tag, and speaks derisively of "the clean air people" who, he said, would force 2,000 people out of jobs at a paper plant in Garrett County rather than relax standards that "wouldn't put one ounce of soot over Columbia."