אשר ידבר הנביא בשם יקוק ולא-יהיה הדבר ולא יבוא הוא הדבר אשר לא-דברו יקוק בזדון דברו הנביא לא תגור ממנו
That which a “prophet” says in the name of Hashem, which doesn’t come true or does not occur, that is something that Hashem did not speak; this “prophet” spoke with iniquity, do not fear him
The Torah tells us that there will come a day when charlatan prophets will come and try to speak in the name of G-d. They will present miracles and wonders and predict the future. It is a capital crime to be a false prophet, and we are not to be swayed by their tricks. How can we tell if they are a charlatan, or the real deal? The Torah gives us the litmus test: if they predict something will occur, and it doesn’t, then we’ll know for sure that they are a false prophet.
However, it’s not so simple. The Rambam teaches us that this only applies to a positive prediction. If the “prophet” says something good will happen, and it doesn’t, we know that they are lying. On the other hand, if they prophesize something negative will happen, like a death or calamity, and it doesn’t happen, that’s not an indication of their sincerity. Hashem is slow to anger, and very patient. Often times a person is deserving of a certain punishment, and the prophet is told that it will occur. Then, the subject repents, and Hashem delays or even alleviates punishment. Perhaps this is why the prophecy didn’t come true, even though we are dealing with a true prophet.
Where is any of this alluded to in our parsha? It simply says that if the prophecy doesn’t come true, this person is a charlatan. The Torah proscribes execution for someone who claims to come in the name of Hashem, and this is the test. If what they say doesn’t come true, we know they are lying. It sounds like in all cases. Is there some indication to the Rambam’s limitation of this test?
One possibility is it’s alluded to in the words בשם יקוק, in the name of Hashem. We are taught that Hashem only associates His name with something good. The Torah says that the “prophet” is speaking in Hashem’s name. It must be then referring to a prophecy for the good. If his prophecy doesn’t come true, then we know for sure that he’s a charlatan. He’s a false prophet, and is to be punished. This is unlike a prophet that speaks about something negative occurring. Even if it doesn’t, that’s not proof of anything. Perhaps Hashem is patient, or has forgiven the person.
 Based on Ta’amah D’Krah to Deuteronomy 18:22, by Rav Chaim Kanievsky shlita
 Deuteronomy loc. cit.
 Mishneh Torah Hilchos Yesodei HaTorah 10:4
 Midrash Tanchuma Tazria § 9, brought by Tosafos to Ta’anis 3a s.v. ואילו