In my understanding Dyson spheres harvests energy but won’t stop stars expansion. Though peer commenter xlance propose to use that energy to changes earth orbit, which address the goal.
But as far as I know building a Dyson sphere would also require a quantity of material resources that we don’t have on earth. Some options to get those:
A. energy to mass, but we don’t know if that’s even theoretically achievable. Also it probably would require a Dyson sphere itself to have enough energy.
B. convert other abundant elements (O, Si, Fe…) into required elements using known atomic reactions. But harvesting that much elements from earth could transform it in a state that does not worth the pain to try “saving” it.
There are serious physical issues about Dyson spheres. Things like constellations of satellites orbiting a star are much more practical solutions than a solid sphere.
Space is big and interstellar travel is slow, but 7.6bn years is a long time, during which we should have become adept at hopping between desirable stars as they come and go.
https://www.youtube.com/watch?v=pzuHxL5FD5U