Yes, there is a police station within Buckingham Palace. It is the base of the Royalty and Specialist Protection (RaSP) Command of the Metropolitan Police (formerly known as Special Branch).
Highly trained armed officers (Authorised Firearms Officers), supported by dog units, search teams, and administrative staff. The unit operates 24/7/365.
Other royal residences (Windsor, Holyroodhouse, Sandringham) have dedicated police posts, but Buckingham Palace hosts the command hub.