Read Matthew 4:1-11.
If you are being tempted, are you sinning?
No. Jesus was tempted, Jesus was without sin.
It's a sin when we act on the temptation and act against God's will and cause a relationship strain.
But how does Jesus avoid temptation? Jesus says each time "Scriptures say". Jesus knew the Scriptures well enough to know what God expects.
Underline "Scriptures Say" in verses 4, 7 and 10 (see the example picture here).
The more we know Scriptures, the more we know God and God's expectations for us, the better equipped we are to resist temptation.