Two Prince George's County men were arrested in Loudoun County yesterday after a bank robbery, a gun battle in the center of Middleburg that left two people wounded and a high-speed chase.

Deputy Sheriff David Simpson was grazed by a bullet when he and the suspects exchanged several rounds of gunfire in the parking lot of the Farmer's Merchant Bank. One of the gunman was also slightly injured in the exchange, police said.

Held without bail in the Loudoun County Jail on charges of armed robbery were Earl A. Johnson, 43, of Upper Marlboro, and Charles Davis III, 34, of Capitol Heights, who received a bullet wound in his foot.

Loudoun Sheriff's Department spokesman L. W. McDonald said two men carrying a sawed-off shotgun and a .357 magnum revolver entered the bank at approximately 10:20 a.m. yesterday and ordered five employes to lie on the floor.

One of the bank employes set off the bank's alarm system while the gunmen were collecting a small amount of money from the teller drawers, police said. When the gunmen realized that Simpson had arrived, they fled the bank and fired five shots at him, police said. One shot grazed the deputy's head, but he returned the fire. A car passing on Rte. 50 was struck by a bullet in the melee, but the motorist was not injured.

Police said the gunmen headed toward Washington on Rte. 50, and were spotted again at Gilberts Corner, the intersection of Rtes. 50 and 15. Police pursued the pair north on Rte. 15 at a high rate of speed for about 5 miles. When police pulled their cars around the suspects' car in a moving roadblock, the suspects rammed one of the vehicles, police said. The suspects were edged off the road near the intersection of 15 and Rte. 733 and arrested, police said.