The officers had apparently failed to recognise the prince, who was strolling the grounds in broad daylight in the late afternoon after attending an event in London on Wednesday.
In a statement, Prince Andrew said: “The police have a difficult job to do balancing security for the royal family and deterring intruders, and sometimes they get it wrong.
“I am grateful for their apology and look forward to a safe walk in the garden in the future.”
London’s Metropolitan Police earlier confirmed that two of its officers had stopped a man in the palace gardens and asked him to verify his identity.
“The man was satisfactorily identified. No weapons were drawn and no force was used,” the police said in a statement that did not name Prince Andrew.
Two days earlier, police arrested a man who had been found inside the palace on suspicion of burglary, trespass and criminal damage. A second man was arrested outside the palace on suspicion of conspiracy to commit burglary. Both men were released on bail.
The queen was not in the palace at the time but in her castle in Balmoral, Scotland.
One of the biggest breaches of royal security took place at Buckingham Palace in 1982 when an intruder, Michael Fagan, climbed a wall and then wandered into the room where the queen was in bed.
Prince Andrew, officially known as the Duke of York, had a career in the Royal Navy before working as a trade ambassador for the British government. He has two daughters, Beatrice and Eugenie, from his 10-year marriage to Sarah Ferguson.