Pretty much every FO struggles with this. Technically yes, in the extreme case. If the actions of the capt are about to get everybody killed or otherwise endanger the aircraft, the FO is supposed to have the authority and an obligation, after a suitable verbal interchange, to intervene by saying "I have control" and take over. Generally there needs to be a trigger such as a situation where the capt does something that deviates outside normal operating limits, procedures, or protocols.
If the capt declines to hand over control, because, say, the capt has gone off the deep end, well you have a problem. But in most cases of suspected suicide by plane for example, the suicidee waits for the other crew member to use the rest room and locks the cockpit door - one unintended consequence of reinforced cockpit doors.
The more likely case is a capt that is disoriented or fixated, and in theory an FO who intervenes with proper procedure and with enough "authority" should be able to do it and a capt is expected to relinquish control in such a situation.
But however well trained the crew is, they are two humans and you can't predict what's going to happen. Different airline cultures apply this kind of thinking more strongly than others. At some airlines the FOs are encouraged to be maybe a little too forceful for most captains' tastes, questioning everything, and others, it's the old fashioned "shut-up-and-pull-gear" culture. This is still a serious problem outside of "western" operators, in countries that have strong patriarchal cultures, which is partly why you see so many "expat" American, Australian/NZ, Canadian, British, or European captains at far east airlines.
But even in up-to-date places like Canada, FO inassertiveness can be a problem. First Air 6560, pretty much the only major crash of a heavy in North America in almost 20 years (excluding runway excursions and Sully's adventure), is a classic case of an FO failing to intervene to thwart an incompetent captain who develops fixation tunnel vision and breaks the most basic rules of the book. Every FO needs to read the Transportation Safety Board report.