Gov. Steve Bullock of Montana, a Democrat who has crusaded against the loosening of campaign finance rules, is suing the Trump administration to block it from eliminating a mandate that politically active nonprofit groups disclose the identities of their major donors to the government.

The Treasury Department announced last week that the Internal Revenue Service would no longer require a range of nonprofit organizations to identify any contributors giving more than $5,000, in a move it described as bolstering privacy and easing administrative burdens for those groups. Previously, certain nonprofits had to name their large donors to the government even though they were not supposed to be disclosed to the public.

The change in rules stirred immediate political controversy because of its effect on so-called “dark money” groups, which spend money in elections but are not required to reveal the sources of their funding except to the I.R.S. Under the new reporting regime, groups associated with organizations like the National Rifle Association, Planned Parenthood and Americans for Prosperity, the conservative advocacy network backed by the billionaire Koch brothers, would no longer have to list their donors, even to the government.

But in a lawsuit filed on Tuesday in Federal District Court in Montana, Mr. Bullock and his administration alleged that the Trump administration had flouted proper government process in eliminating the disclosure requirements. The suit asked the court to issue a judgment voiding the new I.R.S. policy.