Yes, technically, it's possible to create an Organizational Unit and target the following policy on it, to prevent computers from changing their password:
Computer Configuration\Windows Settings\Security Settings\Local Policies\Security Options => Domain member: Disable machine account password changes
Read the documentation to learn more about this policy: Domain member: Disable machine account password changes
To mitigate the security risk, you can disable the computer account once the computer is powered off, then you can enable it again and move it to another OU when you want to use the computer.
However,
I don't think you need to disable the machine account password change... The policy is not enforced by a domain controller, that's a client-side setting: the client device will periodically check if it needs to change its password or not.
I have seen occurrences where you just need to reboot the machine once the password changed, so Windows will get back on the rails.
The next time you need to use a computer after months of inactivity, try the following: Boot the device, ensure it's connected to the network, don't try to log in to the device just let it sit for a few minutes, then reboot the device, and try to log on.
Learn more about machine account password change here and how it should not be an issue: Machine Account Password Process