When it happened to us, they claimed they had UK authority to do so, but gave no details. Whether they really had or not clearly didn't matter to the bored officer who spoke to us - we would have been stopped regardless of our nationality and diplomatic agreements with the US. But it might be interesting to ask the Foreign Office just exactly what has been agreed.
To have the US acting as a self-appointed international maritime police force throughout the Caribbean, as the British did in the C19th, in practice I actually found quite reassuring rather than the opposite. At least it feels like they are on 'our side' and serving to deter the bad guys.
However, it does open the door in ways that are worrying. I prefer not to be ordered to stop by a vessel we can't positively identify in the middle of the night - a snap decision must be made as to whether it is genuine or not (they did illuminate their ship when I requested though). And I would definitely feel much less happy if the navies of some other countries, the North Koreans say, decided to do the same in other parts of the world.
An article I read a few years ago, (I hope my memory of hte article is correct)
You can be stopped by any navy within the teritorial waters of that country reguardless of the flag you are carrying.
You can be stopped in international waters by a navy carrying the same flag as your boat.
You can be stopped by any countries navy and boarded if they have reason to suspect drug trafficking, terrorirsom or security risks from on your vessel. (Apparently this is a grey area).
for all practical purposes there is no law beyond the 12 mile limit. it's just like saying such and such a war is 'illegal', law only has meaning if it can be enforced.
they can do what they like and the foreign office won't lift a finger to help you so you may as well just let them get on with it. the worst thing you could do is to offer resistance.