Jesus did not have to be able or free to sin, for temptation to be real. By virtue of His human nature Our Lord certainly experienced temptation from that human perspective.
Being able to sin is not an essential attribute of human nature. A sinful
nature was taken up, rather it was an unfallen human nature (no original sin present) assumed by the Second Person of the Trinity.
For example, from LBC 8:2:
The Son of God, the second person in the Holy Trinity, being very and eternal God, the brightness of the Father's glory, of one substance and equal with Him who made the world, who upholds and governs all things He has made, did, when the fullness of time was complete, take upon Him man's nature, with all the essential properties and common infirmities of it, yet without sin;
These infirmities of the human nature made temptation possible. But, temptation and sin are not the same. Persons sin, not natures.
Sproul has an interesting take in
Now, That's a Good Question:
Did Jesus have the ability to sin? The problem hidden in that question is that if Jesus did have the ability to sin, does that mean he had original sin and participated in a fallen nature? If that were the case, he wouldn't even be qualified to save himself, let alone us. If he did not have the ability to sin, was his temptation (so central to God's giving him the crown of glory for his obedience) just a charadewas he really not subjected to real temptation?
The New Testament tells us that Jesus was like us at every point save one: He was without sin. It tells us that Jesus became incarnate and took upon himself human nature. It also tells us that he is the second Adam. Generally, classical Christology teaches that when Jesus was incarnate and became the new Adam, he came born with the same nature that Adam had before the Fall. Adam didn't have original sin when he was created. So Jesus did not have original sin. So we would ask the same question: Was Adam capable of sinning? Yes, he was. Christ, the second Adam, was also capable of sinning in the sense that he had all of the faculties and all of the equipment necessary to sin if that's what he chose to do.
Could Jesus have sinned if he had wanted to? Absolutely. Of course, he didn't want to. So if you ask it a different way, could Jesus sin if he didn't want to? No, he couldn't sin if he didn't want to any more than God could sin because God doesn't want to sin. Wanting to sin is a prerequisite for sinning.
But then we have to push it one step further: Could Jesus have wanted to sin? Theologians are divided on this point. I would say yes, I think he could have. I think that's part of being made after the likeness of Adam. When we're in heaven and are totally glorified, then we will no longer have the power and ability to sin. That's what we look forward to; that's what Jesus earned for himself and for us through his perfect obedience. Christ's perfect obedience was not a charade. He actually was victorious over every conceivable temptation that was thrown his way.