Police said two youths, with the fake pistol, entered the Balmoral Dairy in Hillside Rd about 7.30pm on Saturday and stole cash.
They fled but were apprehended soon after. The pair will appear in the Dunedin Youth Court this morning.
The owner of Trade Me Again, a second-hand shop next to Balmoral Dairy, Derek Taylor, said he called police about 6pm when he saw two youths loitering and acting suspiciously across the road from the shop.
At one point he confronted the pair, who looked like ''startled possums'', and told them to leave. Police talked to them and took their details.
The two youths were caught on Trade Me Again's CCTV cameras and police had taken a copy of the footage.
Mr Taylor said it was ''brazen'' and not very smart to rob the shop after they had been spoken to by police so close to the dairy.
Detective Sergeant Christopher Henderson confirmed the pair arrested were the same two earlier seen across the road from the shop.
The police officers who stopped and spoke to the pair earlier in the evening recorded their details and noted what they were wearing.
''As a result of the officers' attention to detail, a subsequent robbery approximately 50 minutes later of the Balmoral Dairy was solved very quickly,'' Det Sgt Henderson said.
Police want to hear from a witness seen in the shop before the robbery. He was described as a Maori or Pacific Islander, of medium build with black hair.
He bought a mixture bag of sweets before leaving.