...using his legal authority to temporarily detain you just to ask where you got your kilt. Even if his intent was benign, that's still not cool. Probably even illegal.
Hmm; that might be a stretch. I'll stipulate that every cop is different, and circumstances affect cases--that is, a cop in a big city will / might / may react differently to something than a small town officer would. However, they all share a certain "cop-sense" as explained to me by my neighbor, an officer in our semi-rural township. "If something looks unusual, it just might be," he told me once. "You get to know what 'normal' looks like."

Not knowing how common kilts are in your area, if he just got a glance of you in the gas station you may have set off his "unusual" light. Normal? costume? disguise? what? he's thinking....worth a look. You're briefly stopped; in that time he determines you're 1) a bit out of the norm but OK, 2) not drunk, 3) and based on a quick visual check, not an imminent hazard or threat. Naturally, he can't say to you "Sorry, you just looked unusual for around here," so he asked about the kilt.

I won't say he couldn't have ignored you completely but I will say what he did was well within the bounds of his job.

Yes, I've been "stopped" (motioned to the side, actually) by a cop in the next town over who simply wanted to look at
the car I was driving. First words out of his mouth were "You're not in trouble..." We talked cars for 20 minutes.