Hello suzana, and welcome to Using English.
Generally, we avoid doing something ourselves. We can prevent something from being done by someone else.
The doctors are doing their best to prevent (the need for ) his leg to be amputated. (I hope they wouldn't try to prevent the surgery if it were medically needed.)
Don't try to use "avoid" and the passive together.
Student or Learner