The difference between the two instances is that the first word תנסו translated in English as ‘test’ is used in the sense to tempt God to go against His will, (in order that He may prove Himself to you). This is improper for a creature to do to his Creator. This is essentially a form of manipulation.
The Accuser suggested this to Jesus
“and said to him, “If you are the Son of God, throw yourself down, for it is written, “‘He will command his angels concerning you,’ and “‘On their hands they will bear you up, lest you strike your foot against a stone.’”” Matthew 4:6
The Accuser was in this case asking Jesus to force God’s hand and go against natural law for something other than God’s express will, which is essentially twisting God’s arm to do the Accuser’s will (forcing God to prove Himself). It’s one thing to fall accidentally or be thrown off a cliff and have God intervene, it’s entirely another to deliberately throw yourself off to prove God’s Word is true.
Jesus wisely responds
“Jesus said to him, “Again it is written, ‘You shall not put the Lord your God to the test εκπειρασεις.’”” Matthew 4:7
The LXX uses the same word forused in both the Deuteronomy and Matthew text
With the Malachi text the word translated in English as test is ובחנוני and it means to test for your own self that God’s Word is true.
The LXX says something different, it says to restore for yourself the truth or to come back to the true intent (of the commandment in this case).
Malachi is different in that God is not asking to be put to the test as it is suggested in English translations but rather, the individual is to examine the commandment by a faithful and personal application of the commandment.
In other words, those Malachi was addressing, were not doing as God asked them and that’s why they were not getting success. But if they followed the commandment in the true spirit of the commandment then they would see the promises come to pass. This is evident when God makes this assessment
“Bring the full tithe into the storehouse, that there may be food in my house. And thereby put me to the test, says the Lord of hosts, if I will not open the windows of heaven for you and pour down for you a blessing until there is no more need.” Malachi 3:10
They were not bringing the whole amount. In the first chapter they were offering blind, lame and sick animals, which again is a deviation from the commandment. It’s like trying to bake a cake and not using all or the right ingredients and hoping to get the same end product. God is saying stick to the original, restore back to the truth, do what I said and see for yourselves that I will honor my Word.