As Royalty, of course, Hamlet has the authority to dismiss people at will. Of course, he will use that authority when he has to.
But there’s something about this particular dismissal – something slightly disingenuous about calling Rosencrantz and Guildenstern “friends” at this point. Something that is highlighted by the preface of “Leave me” to “friends.” It’s like – “Get out of here,” and the “friends” doesn’t soften the effect of the order. It just makes friends slightly sarcastic. Even if he doesn’t say it that way or mean it.