Yes. This is legal, even though it is highly unlikely.
There were very few, if any, instances of the federal pardon power being used this way historically, but it could happen, and President Trump, while he was in office, intimated that he might use the pardon power in this fashion. Realistically, it would be easier for the President to prevent someone from being prosecuted in the first place if the crime took place during his term, but he might pardon someone who committed the crime under a previous administration.
The fact pattern in the question: “don’t be surprised if I pardon anyone that puts to death repeat heroin and fentanyl dealers dealing in amounts larger than 50 pounds” doesn't sound very morally palatable.
But consider a slight variant of it which is much more plausible. Suppose that while running for office a Presidential candidate says:
don't be surprised if I pardon someone who was convicted of homicide
in a previous administration for killing someone who had been using
them as a sex slave in a human trafficking network, or killing someone
who was in the process of raping them shortly before their divorce
became final but was not allowed to assert a self-defense argument at
trial because marital rape was legal at the time.
Now arguably that's different, because it doesn't induce someone to commit a future crime. But the President has broad discretion to make policy to de-emphasize certain kinds of criminal prosecutions in any case while in office even without the pardon power, and generally, this is not a basis for having a special prosecutor appointed at the federal level since there is no individualized conflict of interest.
Of course, the U.S. President can only pardon someone from a federal crime and can't pardon state crimes or criminal convictions from other countries. So, even if the President pardoned someone of a federal crime in this situation, the state in which the murders took place could prosecute the individual for murder unimpeded (constitutional double jeopardy considerations would also not bar a state prosecution following the federal prosecution).
Indeed, the vast majority of murder prosecutions are made under state law, and there are very few murders that take place which are beyond the jurisdiction of any U.S. state and any foreign country, that are in the jurisdiction of the U.S. government and covered by a federal homicide statute, in any year. As noted by @hszmv in a comment to another answer:
Federal Murder charges are a thing and can be prosecuted, but are
normally reserved for murders that either involve federal government
employees (especially if they are murdered because of the duties the
performed in the course of their duty or the status as a federal
employee) OR murders that occur on Federally Owned Property OR the
Murder involved crossing state lines OR is in U.S. Jurisdiction but
not in a territory or state jurisdiction (usually applies to some
uninhabited territorial islands or U.S./International Waters).
Further, a pardon would not prohibit the victim's family for suing the murderer for wrongful death, and indeed, probably wouldn't prohibit them from using the murder conviction that was pardoned to conclusively establish liability in a civil case under the doctrine of collateral estoppel (I haven't researched that highly specific and technical civil procedure issue, however, but even if that wasn't possible, the murder trial transcript would be admissible in the civil case). A civil judgement for wrongful death was famously obtained against O.J. Simpson by the victim's family after O.J. Simpson was acquitted in a criminal murder trial.
This tactic would really only be helpful to a prospective defendant with respect to cases where there is not a parallel criminal offense under state law.