The roles of the microbe-gut-brain axis in metabolic homeostasis, development, and health are well-known. The hypothalamus integrates the higher nerve center system and functions to regulate energy balance, feeding, biological rhythms and mood. However, how the hypothalamus is affected by gut microbes in mammals is unclear. This study demonstrated differences in hypothalamic gene expression between the germ-free (GF) pigs and pigs colonized with gut microbiota (CG) by whole-transcriptome analysis. A total of 938 mRNAs, 385 lncRNAs and 42 miRNAs were identified to be differentially expressed between the two groups of pigs. An mRNA-miRNA-lncRNA competing endogenous RNA network was constructed, and miR-22-3p, miR-24-3p, miR-136-3p, miR-143-3p, and miR-545-3p located in the net hub. Gene function and pathway enrichment analysis showed the altered mRNAs were mainly related to developmental regulation, mitochondrial function, the nervous system, cell signaling and neurodegenerative diseases. Notably, the remarkable upregulation of multiple genes in oxidative phosphorylation enhanced the GF pigs’ hypothalamic energy expenditure. Additionally, the reduction in ATP content and the increase in carnitine palmitoyl transterase-1 (CPT1) protein level also confirmed this fact. Furthermore, the hypothalamic cell apoptosis rate in the CG piglets was significantly higher than that in the GF piglets. This may be due to the elevated concentrations of pro-inflammatory factors produced by gut bacteria. The obtained results collectively suggest that the colonization of gut microbes has a significant impact on hypothalamic function and health.