It is not easy, episodes give only quick glimpses and the firearms in the rack got changed from season to season as did the courthouse itself. Six is the number of long arms held in the rack most often, but there are episodes that show only four. The best way is to review all the images that can be found on line. I recently spent many hours doing just that. When the Andy Griffith Show aired on CBS, I was a young teen and my older brother had just introduced me to hunting and the shooting sports. Recently, I found myself reviewing some of the reruns on METV and found my interest in the question piqued. Some are easy to answer and some, I believe, found themselves being utilized in more than a background prop.
For example there is an episode that involves a shooting gallery. Here you can see two .22 caliber pump action rifles. the rounded receiver with a screw knob on the left, and heavy grooved forearm lends one to ID these as Remington Model 12 rifles. One of this same model gun is often seen in the courthouse rifle rack, 2nd from right. The grooved forearm is a give away. Two other easy identifiers are the levers of two lever action rifles; one is a Winchester (probably a 1894 model), and the other is a .22 caliber as the tubular feed has that slot for loading near the muzzle-probably a Marlin 39. Having owned several war vintage Italian service rifles, I found the numero uno easiest rifle to ID is the Italian Carcano short rifle, the one with a wide sling and often see (but now always) residing on the right of rack. Another foreign rifle from the Second World War that can often be seen in the rack is a Japanese Arisaka Type 99 Carbine, fairly rare. You can tell it is 99, and not a 38, as it features a side mounted sling. The metal extension piece behind the trigger guard and large straight knob of the rifle's bolt helped to pin this one down.
In a photo before me, the six firearms are (right to left); the Italian Carcano, the .22 pump, a long barrel firearm (so long it over reaches the height of the rack) believed to be a single shot shotgun of unknown make, next the Jap carbine, then a non descript double barrel shotgun. The most clearly seen double barrel shotgun images that I have found is an old exposed hammer model with a forearm release button at the tip of the fore end as common to French & Belgium made examples. One episode has Andy holding two shotguns, one the aforementioned, and a pump action shotgun on two no-good nicks. Lastly, on the left of the rack, is an unidentifiable pump action shotgun, very possibly the one here mentioned.
In the link above the following firearms can be seen in the rack from left to right; sporting bolt action rifle with black tipped fore end, the double barrel shotgun mentioned earlier, a .22 caliber (Note: slot in tube magazine) Marlin lever action rifle, Winchester lever action rifle (likely a model 1892 or 94), a sporting Mannlicher type bolt action (bolt handle is well forward of the trigger guard) rifle with sling and white lined fore end tip. At right is a full stocked old military bolt action rifle that is occupying the spot usually taken by that Italian Carcano. Looking at this image makes me want to ID it as a US Model 1917 Enfield but in the episode, Opie's Hobo Friend, there is a side shot of it at the very end that leads me to think that it is a US Model 1903A3 rifle. Either way it has a receiver (peep) sight. The Mannlicher (Steyr of Austria) rifle was used by Barney in one episode alongside the lake.
I've probably detailed folks to death by now. Let me just toss the remaining possible racked firearms at you ASAP: There is one bolt action sporting type rifle often seen on the far left that has a black plastic tipped fore end, cheek piece, and a very ship pistol gripped stock. It also features a very pronounced bolt knob and I believe this gun can be seen with and without a US military style leather sling. . (Black plastic fore end tips & pistol grip caps, including white spacers (as scene elsewhere) were common style in the 1960's.)
The episode that featured Jerry Van Dyke has him and Andy perusing two of the guns from the rifle rack, check it out.
The episode where Otis gets sworn as a deputy shows (at right) the rifle that I think is a 1903A3 Springfield only with a sporter stock with cheek piece (?).
Some of the other guns that were featured elsewhere included; a 1928 Thompson submachinegun, Barney's Colt Police revolver in .38 S&W Special (Ellis Prop Company), a nice over/under shotgun wielded by a female trap shooter that bested Andy, a real nice pump action shotgun with a ventilated rib, checkered stock, a semi-auto shotgun with a white lined rubber butt pad wielded by actor Leo Gordon, more than one snub nosed revolver made an appearance. I was only able to get one (unclear) image of Andy with 'his' revolver. He pulls it from a drawer at his home, a 4-inch barrel six-shooter. It may be a Colt or a Smith & Wesson Model 10.