What's the relevant US code? I was just searching through legal resources for an answer, and this was the first one I found.
And there are no legal guidelines to whether you are allowed to be a federal judge of any kind. The same is not true of prosecutors.
While I'm sure that's always or virtually always been true in practice, nothing in the relevant U.S. Code appears to require it (it is definitely not the case for the Supreme Court).