By default the users group of the Windows 10 computer should have read access to the hosts file.
If your program/user needs write access you have to modify the ACL of the hosts file.
----------
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten