Virginia Gov. Charles S. Robb has stripped two coal mine inspectors of their duties after state officials discovered the inspectors owned stock in the Westmoreland Coal Co., one of the state's largest coal producers.

The two inspectors--and an oil well inspector who owned stock in an oil drilling firm--were ordered to divest themselves of their financial interests in the firms immediately. The names of the three inspectors have also been forwarded to state prosecutors to determine if they should be charged with violating a state law forbidding mine inspectors from holding stock in any coal company, officials said yesterday.

Federal officials said separately in Washington yesterday that Secretary of Labor Raymond Donovan has ordered an inspector general's investigation into the Virginia office of the Mine Safety and Health Administration to determine if it failed to enforce safety laws prior to the June 21 explosion at the Clinchfield Coal Company's McLure Mine No. 1 in southwest Virginia that killed seven miners.

The state's internal investigation of its division of mines was ordered last week by Robb and state Secretary of Commerce Betty J. Diener after The Washington Post reported that Harry D. Childress, the state's chief mine inspector and division director, owned nearly $19,000 worth of stock in the Pittston Co., corporate parent of the company that owns the mine that exploded.

Diener said yesterday that the investigation discovered that Ron Hamrick, an inspector since March 1981, owned 400 shares, valued at about $10,000 in Westmoreland, a Philadelphia-based firm with 14 coal mines in Virginia. Hamrick, who was formerly safety director for Westmoreland's operations in the state, acquired the stock as part of an employe stock ownership plan after 30 years with the company.

Inspector John Thomas, another former Westmoreland official, owned 98 shares of stock in the firm worth about $2,300. Milford Stern, the state's assistant oil and gas inspector, owned 30 shares of stock worth about $550 in NL Industries, an oil and gas drilling firm.

Diener said yesterday that the cases of Hamrick and Thomas were the most serious. "They were former Westmoreland employes, they had Westmoreland stock, and they were inspecting Westmoreland mines," said Diener. "We do not want them involved in any more inspections."

After last week's disclosures, Childress, the chief inspector, sold his stock and was removed from the McClure investigation. He was allowed to remain in his $35,000-a-year job. Diener and other Robb aides said last week that no stronger action was taken against Childress because the state Attorney General's office determined that the law forbidding stock ownership applied to a "mine inspector" but not the "chief mine inspector."

All three inspectors said yesterday they were unaware of the state mining law prohibiting stock ownership until last week and one of them, Thomas, said he volunteered the information about his stock after he heard about Childress' holdings.

"I had no idea it was a conflict of interest or anything," said Thomas, 31, who earns about $21,000 a year. The law "had never been mentioned to us."

"Hard as it may be to believe, I had never read that section," said Hamrick, a 53-year-old inspector who earns $20,800 a year. "If I did anything wrong, it was unintentional."

Diener said that the inspectors should have been aware of the provision. "Each of them has a book of all the state's mine regulations that they carry around with them at all times," she said. "When you carry that book around with you everyday, it's hard to say that you didn't know that the law was on the books."

The United Mine Workers, which has demanded Childress' resignation, decried the stock ownership discoveries as a "blatant conflict of interest" and "just another example of lax enforcement of the law" in Virginia. Union spokesman Joe Corcoran, noting Childress' treatment, said: "It's somewhat inconsistent with the spirit of the law to let the chief off easy and then to get tough with three inspectors."

Diener said yesterday that Attorney General Gerald L. Baliles will conduct his own investigation into the stock ownership and report back to the governor, possibly by the end of the week, to determine if any administrative action, including possible disciplinary steps, should be taken. In the meantime, all three inspectors have been relieved of their inspecting duties.

Childress said yesterday that they have been "reassigned to office work . . . . We have some paperwork" for them to do.

The Labor Department's investigation of the federal MSHA office was ordered by Donovan after the Post reported that the Norton, Va., office had issued the lowest rate of "serious and substantial" violation notices of any such office in the country. "We thought that it's best that we take an independent look at that," said J. Brian Hyland, deputy inspector general. "If there is smoke, sometimes there is fire."