When Jesus was tempted in the wilderness by Satan, could He have sinned? Was it possible? Here is how I see it: If it was not possible for Him to sin, we would not learn anything from his temptation. On the other hand if he did not resist the temptation, He could not have been our Savior, He would have needed one for Himself.
Yes, of course Jesus could have sinned. Like us, he had free will, either to do what is right or to do what is wrong. He was human. He was tempted to anger at the hypocritical Pharisees. If Jesus could not sin, then he could not be tempted, but we know that he was tempted. In fact, according to Hebrews 4:15, “For we have not a High Priest who is unable to feel for us in our weaknesses, but one who was tempted in every way just as we are tempted, and yet did not sin.” Jesus was sorely tempted in the Garden of Gethsemane. He did not want to do God’s will, yet he said to God, “Not my will but yours be done.” If you are not sure, you could perhaps ask Satan, who obviously believed that Jesus could sin, otherwise he would hot have bothered to tempt Jesus to sin. One of the reasons that Jesus is such a great high priest for us is that he is fully God and at the same time fully human. Because he has experienced everything we experience, he is able to intercede for us with the Father.
Even if Jesus could not sin (but he could!), we still could learn something from Satan’s temptation of Jesus in the wilderness. In either case, we can learn from this account how Satan will tempt us, as his method with Jesus will be the same as how he will tempt us. From Luke 4:1-3 we learn that Satan will tempt us by appealing to our pride (v. 3), by appealing to our desire for worldly things (v. 5-7), and by tempting us to put God to the test (v. 9-10). We also learn from this passage that one of the best ways to oppose the temptations of Satan by using the scripture, which is the approach that Jesus used to turn aside Satan’s temptation.
You are right that if Jesus had sinned, he could not have been a perfect savior–an unblemished Passover Lamb. That is the greatness of Jesus. He was tempted just like us, yet did not sin. In John 8:46 Jesus challenged those who knew him well, “Can anyone prove me guilty of sin?” The silence of the crowd speaks for itself.
I hope this helps.