Suppose NIAID director Dr. Anthony Fauci is elected President. If he never officially resigned from his position as a director, and he was never forcibly removed from the same position by the former President or by Congress, could he legally serve as both President and director, and thereby have direct control of the NIAID (as opposed to the bureaucratic nightmares that might otherwise get in his way)?
Under the Hatch Act, Fauci would not be allowed to run for President while employed by the federal government. He would have to resign his post as NIAID director before beginning a campaign.
If he did so and were then elected, there's a question of whether he could reappoint himself as NIAID director. In the Office of Special Counsel Hatch Act FAQ there is a question "May I keep my elected position if I become a federal employee after taking office?", saying that an elected official can be appointed to a federal office. It is unclear to me whether he could actually appoint himself. NAIAD Director doesn't appear to be a politically appointed office, so in principle it would probably be the NIH Director making the appointment.
Also, if someone else had been appointed in the meantime, there would be a question of whether that person could be fired to make way for Fauci's reappointment. Generally a Civil Service employee can't be fired except for cause, and the firing can't be done by the President directly; this question came up during the Trump administration. The NIH Director or HHS Secretary could fire them, but would still have to show cause, and the sitting NIAID director would have the right to an appeal process.
Even if Fauci was able to serve as President and NIAID Director simultaneously, he'd still be subject to the Hatch Act restrictions in the latter role. So while he'd be President, he'd be forbidden to pursue any political activities - which would make the job of President nearly impossible.
The Constitutional scheme under the Appointments Clause says that the President nominates certain principal officers, to be approved by the Senate, but that Congress can legislate so that inferior officers are appointed by the President alone, by a court, or by the head of an executive department. Edmond v. United States, 520 U.S. 651 (1997) is one of many authorities discussing this separation, pointing out the various difficulties in drawing the line in some special cases, and connecting the different models to the overarching Constitutional purpose.
In the case of principal officers, it is envisaged in 3 U.S. Code § 19(d)(3) that a Cabinet member succeeding to the Presidency would forfeit his Cabinet position. Likewise, 5 U.S. Code § 3345-3347, which governs the appointment of acting officers in Senate-confirmable positions, does not let a President nominate himself (it talks about him being able to appoint employees of executive agencies, for example, but he himself is not one of those). There is nothing here to prevent a President nominating himself to the Senate - because the Senate's decision to consent is its own, not encoded in law. But the overall thrust is against anybody being a President and a "principal officer" at the same time.
If that is so, then still less can a President be an "inferior officer". In Edmond, the Supreme Court found:
Generally speaking, the term "inferior officer" connotes a relationship with some higher ranking officer or officers below the President: Whether one is an "inferior" officer depends on whether he has a superior. It is not enough that other officers may be identified who formally maintain a higher rank, or possess responsibilities of a greater magnitude. If that were the intention, the Constitution might have used the phrase "lesser officer." Rather, in the context of a Clause designed to preserve political accountability relative to important Government assignments, we think it evident that "inferior officers" are officers whose work is directed and supervised at some level by others who were appointed by Presidential nomination with the advice and consent of the Senate.
It would be a nonsense for the President's work to be directed and supervised by somebody that he himself supervised. Although Federal law provides mechanisms for merit-based appointments, and for those to be overridden by the President in special circumstances, that's not enough to make it Constitutionally viable - it violates the scheme of the Appointments Clause. It could also be argued that the effect of this dual role would be to subvert the governmental structure established by Congress, e.g. by effectively removing the supervisory authority of the Secretary of Health over one of his own agencies.