We present a framework to model and provide numerical evidence for compartmentalization in the yeast endoplasmic reticulum. Measurement data is collected and an optimal control problem is formulated as a regularized inverse problem. To our knowledge, this is the first attempt in the literature to introduce a PDE-constrained optimization formulation to study the kinetics of fluorescently labeled molecules in budding yeast. Optimality conditions are derived and a gradient descent algorithm allows accurate estimation of unknown key parameters in different cellular compartments. For the first time, the numerical results support the barrier index theory suggesting the presence of a physical diffusion barrier that compartmentalizes the endoplasmic reticulum by limiting protein exchange between the mother and its growing bud. We report several numerical experiments on real data and geometry, with the aim of illustrating the accuracy and efficiency of the method. Furthermore, a relationship between the size ratio of mother and bud compartments and the barrier index ratio is provided.