…do not be afraid of him. (Deuteronomy 18:22)
It is forbidden to fear executing the idolatrous prophet. This is true even if he was telling us in the name of an idol to observe the laws of the Torah.
The reason for this mitzvah is that sparing the idolatrous prophet enables him to perpetuate his false doctrine. By being afraid to carry out his sentence, we would also be giving credence to his claims.
This mitzvah applies in Temple times when there is a Sanhedrin capable to try capital crimes. In the Talmud, is discussed in tractate Sanhedrin on page 16a. It is codified in the Mishneh Torah in the fifth chapter of Hilchos Avodas Kochavim. This mitzvah is #29 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos.