“you are not to listen to the words of that prophet.” This is a huge and important point. Most people who read the Bible say that if a prophet foretells a sign or wonder and it comes to pass then he is a true prophet of God, but that is not the case. The signs and wonders of many false prophets come to pass. The people are to know the Word of God well enough to discern whether or not what the prophet said is godly or not from God. It is the Word of God that tells whether a prophet is true or false, not whether the sign or wonder comes to pass. 1 Corinthians 14:29 says that when a prophet speaks others are to judge what is said, and 1 John 4:1 says not to believe every “spirit” (prophecy) but to test them to see if they are from God, because many false prophets are in the world. [For more on the word “spirit” sometimes referring to a prophecy, see commentary on 1 Cor. 14:12].
“for Yahweh your God is testing you.” This does not mean that God sent the false prophet so He could test the people. It means in God’s eyes the everyday situations in life in which people are tempted to turn from the true God and His commands and follow their own desires or the ungodly advice of others are tests that God wants us to pass and which demonstrate our love for Him. Life is full of tests that demonstrate our love for God. God says to pray. Do we? God says to help the poor and needy. Do we? God says people live by every word of God. Do we read and learn the Bible, or do we neglect and ignore it and not know what it actually says? God says not to have other gods. Do we obey that, or do we “help” God out by having “lucky” objects, and/or protective amulets, wearables, statues, etc., things that then end up taking some of God’s glory? Do we fully follow God’s commands, or if a modern “prophet” (a prophet, teacher, counselor, leader) tells us its okay to do something contrary to God’s Word do we follow the words of that “prophet?” There will be a Day of Judgment, and the wise person knows that and so obeys the words of God, not their own desires that are conditioned by the ungodly society around them or the words of others that lead them from God.