During the first seven months of this year, Maryland's senators clashed often with President Reagan, as did two Democratic members of Congress from suburban Maryland, Michael D. Barnes and Steny H. Hoyer, a look at voting records shows.

The area's Republican congresswoman, Marjorie Holt, remained a loyal Reagan soldier, while Democrat Beverly B. Byron, straddled the political line.

Sen. Charles McC. Mathias (R) supported President Reagan this year on two crucial votes: funding for the MX missile system and the nomination of Attorney General Edwin Meese III.

But in many other votes during the seven months preceding the August recess, the Maryland Republican parted company with Reagan on issues ranging from South Africa sanctions to gun control to the development of lethal chemical weapons.

Sen. Paul S. Sarbanes (D) and Barnes, who represents Montgomery County, clashed even more often with the Reagan administration, while Prince George's County's Hoyer often found himself aligned with Reagan on defense issues and opposing him on domestic policies.

Holt, the Anne Arundel-southern Prince George's representative who recently announced that she plans to retire, was one of Reagan's most consistent supporters in the Maryland delegation. Byron, whose district includes Western Maryland and part of Montgomery, supported many of Reagan's defense policies.

On the South Africa issue, Mathias, Sarbanes and Baltimore's Democratic Rep. Parren J. Mitchell played prominent roles in the congressional fight over economic sanctions to protest South Africa's policy of apartheid.

In the spring, Mathias introduced a measure to impose economic penalties against South Africa, but only if the country failed to make progress after about two years. He decided harsher action was needed after the South African government's decision in July to declare a state of emergency, which caused an escalation in violence.

The bill that passed the Senate imposed some immediate sanctions, and Mathias and Sarbanes both voted for the bill, which the Reagan administration opposed. The two Maryland senators were appointed to a conference committee to resolve differences between the Senate bill and a much stiffer House measure.

The House bill included an immediate ban on the importation of krugerrands, or South African gold coins, and on new U.S. investments in South Africa. Senate conferees first objected to the two provisions, but Sarbanes said they decided to accept the ban on krugerrands, largely because of an eloquent personal plea from Mitchell.

The House approved the conference report on Aug. 1, and it was supported by all the Maryland House members, including Holt and Baltimore County Rep. Helen D. Bentley, who had voted against the more severe House bill in June. The Senate is scheduled to consider the compromise on Sept. 9, and both Sarbanes and Mathias support it.

On the issue of nerve gas production, Hoyer, Byron and Holt supported the Reagan administration's push for new lethal chemical weapons. Sarbanes, Mathias and Barnes opposed efforts to resume chemical weapons production.

Sarbanes, Mathias and Barnes also urged cuts in the Reagan administration's Strategic Defense Initiative, known as Star Wars. Hoyer and Byron voted against major cuts in the antimissile defense request but voted for minor reductions. Holt was opposed to any reductions.

On aid to the Nicaraguan contras, Barnes, Hoyer, Sarbanes, and Mathias voted against sending nonmilitary aid to the rebels trying to overthrow the leftist government. Holt and Byron supported the administration's successful effort to get aid for the rebels.

During floor debate, Barnes argued unsuccessfully that aid should be restricted to Nicaraguan refugees outside of Nicaragua, and to the peace initiatives being developed by Mexico, Panama, Venezuela and Colombia.

Mathias, Sarbanes, Barnes and Hoyer also opposed repeal of the so-called Clark amendment, which has restricted U.S. covert aid to factions fighting in Angola. Holt and Byron supported its elimination. The Clark amendment was opposed by the administration because it had stopped CIA efforts to aid rightist guerrillas.

On gun control, Sarbanes and Mathias voted against a measure to revise and weaken gun control laws, an effort backed by the Reagan administration. Mathias offered an unsuccessful amendment to allow federal agents to continue to make unannounced inspections of gun dealers. The House has not voted on the issue.

On the budget, Mathias was most critical of the failure of Congress to raise taxes to balance the budget. "If we are serious about attacking the dangerous deficit . . . we must ask each American to be willing to make a sacrifice, if that is necessary," Mathias said during the Senate debate.

Mathias and Sarbanes supported efforts to retain the cost of living adjustment for Social Security recipients, as well as proposals to restore funds to Head Start, developmental disability and handicapped programs and the guaranteed student loan program.

During the House budget debate, there were fewer votes on specific programs. One controversial amendment was the creation of a minimum tax on corporations to help reduce the deficit. Barnes and Hoyer supported the minimum tax, while Holt and Bentley opposed it