Is it safe to use Windows 8.1? Yes, it's safe as long as you don't expose it to the internet. Windows 8.1 is defenseless against today's threats from the internet, and antivirus software doesn't solve that. Your antivirus software can't make up for fundamental weaknesses in the operating system.
Support for Windows 8.1 ended more than a year ago (on January 10, 2023) so malware writers know that its weaknesses won't be fixed.
Use your Windows 8.1 computer as a game server, or as a media server. Use it for backing up, or for learning how to code. Just don't expose it to the internet.