I don't know what distro you are on. I had the same problem with 2 games. Stormworks and Cyberpunk 2077. I'm on Arch and installed nvidia-prime from the AUR. Then for just those two games in the steam launch options I put prime-run in there. That fixed the problem for me. I did use nvtop to verify that it was using the igpu instead of my GTX 1060.
When stormworks was running on the igpu it was at 3fps. Now it's buttery smooth. No other games I play have had that issue.