This project could be of interest
Not sure it applies fully in your case but may be adapted to fill your need. It implements special github functions for another github server with another github TOKEN.
BTW, you can set any github accounts you want with RStudio. You just have to configure GIT in your project to work with the account you want for the specific project.
For installing from Github with install_github, you can use several token saved in different env var and pass them as argument in the functions to use one or the other. This should work with gh
too.
I may have misunderstood what you meant by two github accounts in RStudio. If so, please give precision on what you want to do.