The measure was outlined in the Scottish government's response to last year's Vale of Leven inquiry report.
The probe, led by Lord MacLean, was heavily critical of care standards at the Dunbartonshire's hospital during a C. diff outbreak in 2007 and 2008.
Of the 143 patients with C. diff, it was a contributory factor in 34 deaths.
Announcing the Scottish government's response to Lord MacLean's report, Health Minister Shona Robison said: "I want to take the opportunity once again to say how sorry I am to all those who were affected and continue to be affected by this tragedy."
The government response said that it had taken on board all 75 recommendations from Lord MacLean's report and would "go beyond some recommendations in order to make hospitals as safe as possible".
It also said that since the C.diff outbreak at the Vale of Leven, improvements had been put in place.
This included the establishment of a Healthcare Environment Inspectorate (HEI) to provide "independent and rigorous scrutiny and assurance" that hospitals in Scotland were equipped to tackle infection rates.
Ms Robison said that under new measures Healthcare Improvement Scotland - which operates HEI teams - would have the power to close hospital wards to new admissions if inspectors had concerns over patient safety.
"Although NHS Scotland has made significant improvements since the Vale of Leven hospital outbreak in 2007, particularly around infection prevention and control measures, more can be done to achieve our aim of having a world class health service," she said.
"This is why we are going beyond some of the recommendations by working with NHS health boards and staff to assure the public that our hospitals are safe.
"While Lord MacLean's report focused on one hospital there are clear messages for everyone up and down the country who are working in and with the healthcare system."
Ms Robison added: "It is crucial that health boards continue to put systems in place to prevent mistakes happening, and when they do happen, to learn quickly from them."
Hospital inspectors are to be given the power to close wards to new patients following Scotland's worst outbreak of Clostridium difficile (C. diff).