Motile cilia are eukaryotic organelles with essential chemo- and mechanosensing functions across evolution, from single cell organisms to humans. Motile cilia of the mammalian nervous, respiratory, and reproductive systems are characterized by unique motility proteins to generate fluid flow essential for transporting metabolites and removing mucus. The molecular mechanism underlying motile cilia assembly remains unknown. Here, we use high-resolution imaging, proteomics, in situ cryotomography, and single-molecule motility assays to identify mammalian KIF27, a motor protein of the Kinesin-4 family and homologue of the Hedgehog pathway regulator COS2/KIF7, as a key regulator of motile cilia assembly in vivo. We show that KIF27 promotes the integrity of the transition zone (TZ), a diffusion barrier situated at the cilium base. Loss of KIF27 results in specific and profound defects in axonemal structure and disrupts cilia beating, which collectively lead to organismal phenotypes that recapitulate primary ciliary dyskinesia (PCD). We show that the motile properties of KIF27 are dispensable for its function in motile cilia assembly. Instead, KIF27 acts as a microtubule scaffold to regulate the TZ architecture and enable correct ciliary incorporation of motility-generating proteins. Given that KIF27 orthologues exist in different evolutionarily lineages, we propose that the ancestral activity of KIF27/KIF7 kinesins was to form a microtubule-associated scaffold for protein–protein interactions pertinent to cilia formation and signaling. The transition-zone-associated KIF27 activities may represent a general building principle for the motile cilia assembly in diverse species and cell types.