The primary goal of counting cards is to keep track of the ratio of high-value to low-value cards remaining in the deck, allowing players to adjust their bets and gameplay accordingly.