The public health sector, considered to be vital, especially in this pandemic crisis of COVID‐19, requires automation and control of drug distribution in pharmacies commonly called: “Dispensing.” In this paper, we address the medication assignment problem for automated dispensing cabinets (ADCs). First, we use a network of conflicting timed event graphs (CTEGs), a class of timed Petri nets with shared resources, to model pharmaceutical cabinets. Second, we develop a new method for controlling CTEGs under mutual exclusion constraints (MECs) to solve the problem of drug assignment, using a control approach based on Min‐Plus algebra. Finally, a case study of assigning drugs is given to illustrate the proposed methodology and show the efficiency of the developed control laws.