In this article, we present a novel methodology for inventory management in the pharmaceutical industry, considering the nature of its supply chain. Traditional inventory models often fail to capture the particularities of the pharmaceutical sector, characterized by limited storage space, product degradation, and trade credits. To address these particularities, using fuzzy logic, we propose models that are adaptable to real-world scenarios. The proposed models are designed to reduce total costs for both vendors and clients, a gap not explored in the existing literature. Our methodology employs pentagonal fuzzy number (PFN) arithmetic and Kuhn–Tucker optimization. Additionally, the integration of the naive Bayes (NB) classifier and the use of the Weka artificial intelligence suite increase the effectiveness of our model in complex decision-making environments. A key finding is the high classification accuracy of the model, with the NB classifier correctly categorizing approximately 95.9% of the scenarios, indicating an operational efficiency. This finding is complemented by the model capability to determine the optimal production quantity, considering cost factors related to manufacturing and transportation, which is essential in minimizing overall inventory costs. Our methodology, based on machine learning and fuzzy logic, enhances the inventory management in dynamic sectors like the pharmaceutical industry. While our focus is on a single-product scenario between suppliers and buyers, future research hopes to extend this focus to wider contexts, as epidemic conditions and other applications.