Opening task manager will cause the cpu and the gpu will clock down. Try turning off windows xbox game bar and everything under capture. “Windows Game Bar” and “Game DVR” Check that your system is not overheating. CPU/gpu can throttle this way. Try different gpu drivers both old and new. Check that your gpu is not stuck in a low power state while gaming. GPU-z can help with this. Set the high performance option under power options. Enable/disable V-Sync. Disable anti-virus while playing games. Reduce the graphical settings of your PC. You can set a setting in the drivers that causes performance issues, reset these setting to default. SSD full and anti-virus/malware scan already posted. A new Windows update can also cause stuttering. Same with driver updates, example gpu drivers. Sometimes newer is not better. Cumulative patches like KB5001330 and KB5001337 are examples were people get random stuttering. If your hardware is unstable that can cause stuttering. Sometimes OC's become unstable over time. Sometimes XMP RAM settings are not stable, try running your RAM at jedec standard speeds and see if that helps. Add your game to exclusions for windows defender. Make sure you are not downloading windows updates. USB devices can cause stuttering. Headsets are an example. Bad power delivery from the PSU can be a cause. Auto saving in a game can cause stuttering.
Make sure only programs you need load at startup. Sometimes people have a million task bar icons loading at startup.
Turn off dynamic tick windows 10. I have never needed to do this.
Turn off your Diagnostic Policy Service. Never had to do this.
The RX580 is old and due replacement. Many guides have this as a last option. Upgrade the PC. A decent NVMe drive or a SSD drive can help keep things smooth.
Stuttering can be hard to troubleshoot as it can be anything. Also its harder to diagnose remotely.