WASHINGTON — The Obama administration said on Tuesday that it would test new ways to pay for prescription drugs in an effort to slow the growth of Medicare spending on medicines while encouraging doctors to choose the most effective treatments for their patients.

The announcement comes as presidential candidates including Hillary Clinton, Senator Bernie Sanders and Donald J. Trump are calling for government action to protect consumers against high drug prices.

Federal officials said the government spent $20 billion last year under Part B of Medicare for prescription drugs administered in doctors’ offices and hospital outpatient departments.

The current payment formula provides “weak incentives” for doctors to choose the lowest-cost therapy to treat patients effectively, the administration said. Indeed, it said, the current payment formula “may encourage the use of higher-price drugs when lower-cost drugs of equivalent effectiveness are available.”