BOSTON — Reputed mobster James “Whitey” Bulger cannot argue at his trial that a now-dead law enforcement official granted him immunity from prosecution, the new judge presiding over his case has ruled.

The 83-year-old Bulger is scheduled to go on trial next month in connection with 19 slayings. He has pleaded not guilty. His lawyers argued they should be able to present a trial defense claiming he had immunity.

But in a ruling filed Thursday, U.S. District Judge Denise Casper upheld a decision by the case’s previous judge, who was removed because of the possible appearance of a conflict of interest. Casper said “any alleged immunity agreement … is a bar to prosecution to be determined by the court and not a defense to the crimes charged.”

The ruling followed a decision by Casper on Monday in which she said the government can’t be forced to disclose the identity of a confidential informant.

The defense had argued that the informant had information that the defense needed to impeach a government witness’ testimony. But the judge found disclosing the person’s identity wouldn’t be vital to the defendant getting a fair trial.

The judge’s immunity ruling suggested two related defenses Bulger could present to a jury.

If Bulger opted to use a so-called public authority defense, he would have to show he engaged in alleged criminal conduct at the behest of a government official and reasonably relied on that person’s power to authorize the action.

The judge also wrote that Bulger could present an “entrapment by estoppel” defense, arguing that a government official told Bulger his alleged criminal conduct was legal and he reasonably relied on that representation, so prosecution would be unfair.

She said the defense indicated before her ruling that they didn’t plan to use either tactic.