Epithelial cell adhesion molecule EpCAM is expressed in pluripotent embryonic stem cells (ESC) in vitro, but is repressed in differentiated cells, except epithelia and carcinomas. Molecular functions of EpCAM, possibly imposing such repression, were primarily studied in malignant cells and might not apply to non-pathologic differentiation. Here, we comprehensively describe timing and rationale for EpCAM regulation in early murine gastrulation and ESC differentiation using single cell RNA-sequencing datasets, in vivo and in vitro models including CRISPR-Cas9-engineered ESC-mutants. We demonstrate expression of EpCAM in inner cell mass, epiblast, primitive/visceral endoderm, and strict repression in the most primitive, nascent Flk1+ mesoderm progenitors at E7.0. Selective expression of EpCAM was confirmed at mid-gestation and perinatal stages. The rationale for strict patterning was studied in ESC differentiation. Gain/loss-of-function demonstrated supportive functions of EpCAM in achieving full pluripotency and guided endodermal differentiation, but repressive functions in mesodermal differentiation as exemplified with cardiomyocyte formation. We further identified embryonic Ras (ERas) as novel EpCAM interactor of EpCAM and an EpCAM/ERas/AKT axis that is instrumental in differentiation regulation. Hence, spatiotemporal patterning of EpCAM at the onset of gastrulation, resulting in early segregation of interdependent EpCAM+ endodermal and EpCAM-/vimentin+ mesodermal clusters represents a novel regulatory feature during ESC differentiation.