You’ll encounter the Mirelurk Queen in Fallout 4 at the Castle when you help Preston and the Minutemen take back their original base of operations. The Queen is one of the toughest enemies you’ll face in the game, so make sure you’re loaded up with Stimpaks and Psychos if you have them. And all the explosives you can possibly get will definitely not do you harm.
First up, a good strategy would be to place mines all over the area once you’ve taken care of the Mirelurks and their Hatchlings. Before disposing of the eggs and triggering the Queen, place mines around the Castle courtyard. The Queen is extremely tough, so you’ll need all the extra firepower you can get. If you have the Vertibird signal grenades from joining the Brotherhood of Steel, you can also throw one down now so that the Vertibird will enter the fray just as the Queen appears.