It's important to know that God does not inflict temptations on us. He may allow them, but he never causes them. As much as we might wish that he would step in to prevent all temptations, there is an important reason why he allows them.
In order to keep all temptations away from us, God would have to take away our free will. The reason for this is because a temptation is an opportunity to choose something other than God's way for us. Without those opportunities, we would not actually have a choice and would therefore not truly have freedom. And God wants us to choose him freely, not because we are forced to do so. Choosing God freely is the same as loving him. Choosing him because you have no other choice is something very different.
Click here for a great article on temptation, written by a priest, that answers this question (and many others) in more detail.
Even Jesus, who we know is himself God, faced temptation. His strength in overcoming every human temptation should give each of us hope that we can follow this example, choosing love rather than sin.
For more questions and answers in video format, visit our YouTube Channel:
https://goo.gl/2To8Xy.