As Dure says, theoretically, yes. But remember, the monarch can't govern by decree. People go on about royal assent, but forget that Parliament has to provide it's assent first. A Prime Minister has to find a majority in the Commons and then respond to that affect to the monarch before they are Prime Minister. If they can't, then they are not Prime Minister.
The last time this happened was when William IV sought to supplant Melbourne with Peel. Peel couldn't find a majority in the Commons, William was eventually forced to back down, Melbourne got his job back. Much the same thing would occur in the majestically unlikely event of it happening today. If a monarch dismissed a Prime Minister on a whim, then the Commons, and in particular, senior ministers, would simply say to whoever the monarch tried to install, 'up with this we will not put.'
Both Parliament and the monarch could, in extremis, act as a check on the other if that was neccessary.