How to change power button action using advanced power settings
Open Control Panel
Search for power options
Open the advanced power settings for your power plan.
Under Power buttons and lid, set the Power button action to what action you like, and click/tap on OK.
NOTE: You will only have two separate columns: On battery and Plugged in options if your PC runs on a battery or is a desktop PC with a UPS connected to it via data cable. The Hibernate option will not be listed unless you enabled hibernate and have turned off the Hybrid sleep option in the advanced power plan settings. If you wanted Hybrid, then turn on hybrid sleep in your advanced power plans settings and you select Sleep for the action below.