Only in the “most unusual and extraordinary circumstances” "conceivable"
Respect for the chain of command is central to the armed services. As a result, lower ranked officers generally cannot relieve a higher ranked officers of command. Instead, they must work through the chain of command, taking their complaints to their superior's superior. To do otherwise is usually considered mutiny. As far as I know, the only service that has made formal provisions for this is the Navy. This makes sense, given that ships at sea may be out of contact for extended periods.
The Navy regulations involving a subordinate can relieve a superior of command are found in § 1088. Relief of a Commanding Officer by a Subordinate of Chapter 10: Precedence, Authority and Command of the US Navy Regulations, issued by the Secretary of the Navy. Here is what that sections says:
In the “most unusual and extraordinary circumstances,” a commanding officer can be relieved only by the “next in succession to command.” The problem must be so “obvious and clear” that any “reasonable, prudent and experienced officer” could reach only a “single conclusion:” that leaving the officer in command would “seriously and irretrievably prejudice the public interests.”
Unless it is a “undoubtedly impractical,” the subordinate cannot act “without the approval of…higher authority...” The subordinate can act only after “much careful consideration” and after an “exhaustive investigation of all the circumstances…” The decision “must be based upon…substantial evidence,” and supported by “the official views of others in a position to form valid opinions…”
Any subordinate who relieves a superior will “bear the legitimate responsibility for…such action,” and “must be prepared to justify…” it.