Tommy Mendez went out with $3 to buy cookies at the corner store — but even in leafy Carroll Gardens, that proved to be perilous.

The 10-year-old was held up at gunpoint on one of Brooklyn’s safest streets by three men who forced him to hand over the three singles — and threatened to kill him if he snitched.

“I got really scared,” Tommy told The Post. “I didn’t want to tell my parents because I thought they would get mad at me for going out without permission. It was a big mistake.”

The crime took place at 4:30 p.m. Dec. 8 near the boy’s home and across the street from PS 149, also called The Brooklyn New School.

“I saw three teenagers. They had hoods on and it was hard to see their faces. One of them asked me if I wanted any candy,” Tommy said.

“Then the guy asked me if I had any money. I hesitated and I got really scared.

“I took out my only three dollars . . . They took it and started running.”

Afraid to tell his parents he was out alone at dusk, Tommy kept quiet for three days before coming clean to a school crossing guard who saw him crying.

“I found the crossing guard and told her what happened,” he said. “I didn’t want to be alone on my block. I thought I would see those guys again. The crossing guard called the police and they talked to me. Then my dad showed up.”

Tommy’s father, Jose Mendez, said his son was traumatized.

“He was shocked. He was crying,” Mendez, 35, told The Post.

“I asked him, ‘Why didn’t you tell me? Why didn’t you tell Mom? We could have called the police right away,’ ” José recalled.

“He said, ‘You know, Papa, I’m afraid because they told me, ‘If you tell anyone, we’re going to kill you.’ ”

The father and son went to the 76th Precinct station house, where cops showed them photos of possible suspects, but the boy didn’t recognize anyone. There were no witnesses and no surveillance video of the robbery, police said.

Additional reporting by ­Reuven Fenton