I don’t believe an octopus could use scalpels and other tools build for human hands with sufficient precision to perform surgery.
But, I think there could there be tool designs that would give the octopi sufficient control that they could be effective surgeons.
I’m of the opinion that designs accommodated three or more tentacles would let them have proper control. My reason is that the range of motion of a single tentacle is kind of like one of our fingers but they don’t have a rigid point of flexion like the palm and wrist. So the tools provide that.
A surgeon can control a blade in six to twelve degrees of freedom — (x,y,z roll, pitch, yaw, etc) — complex objects can move in space at 6N degrees of freedom, where N is the number of linkages in the system. But, an octopi tentacle is more limited, its curls between more than fingers, since it more contracts or elongates rather than flex and extending bounded by the bones in our fingers.
We can hold our fingers in fixed rigid position, whereas octopi either are relaxed, contracted, or elongated. But, tentacles can be moved in opposition to one another. So as along as the tool lets them balance the forces precisely, I think that they’d have control good enough for surgery.
And, in a world where they can be in space with lower gravity, there would be robotic surgical tools like we have today. I think the controls would be different for an octopus surgeon, like more knobs, but they’d work just as good for humans as for octopi.