To be fair, I’d say cowboy appearances would be relatively proportional to the population, maybe 1 or 2% of each series…
Except DS9, which has a bit of an Alamo obsession.
Maybe not literally, but the season 3 episode where Discovery arrived in the future went hard on the western vibes. I think they even included swinging saloon doors at one point.
In case of TOS, they literally pitched it as a kind of Western but in space to the studios due to the popularity of the genre on TV (both DeForest Kelly and Shatner had also already appeared in Western serials).