In Windows 10, tap Start, then tap the gear on the left side.
Tap System > Power & Sleep > Additional Power Options.
On the left side, tap "Choose what the power buttons do".
Set all options to "Do Nothing".
If your device does not have "When I press the sleep button" or "When I close the lid", ignore those settings.