Panax Ginseng (PG) has been used to strengthen memory and physique for thousands of years, because its main components ginsenosides (GS) and ginseng polysaccharides (GP) play a major role, but its mechanism is not clear. In this study, a rat model of dementia with vital energy deficiency (DED) was established through intraperitoneal injection with D-galactose and AlCl3 and combined with exhaustive swimming. Pharmacological studies and the urine metabolomics based on ultra-high-performance liquid chromatography-quadrupole time-of-flight mass spectrometry (UPLC-Q-TOF-MS) were employed for evaluation the efficacy of PG and exploring this treatment mechanism. Through urine metabolic profiling, it can be seen that DED rats after PG administration are close to normal group (NG) rats, and PG can regulate the in vivo status of DED rats which tend to NG. The results of behavioral, biochemical indicators and immunohistochemistry further verified the above results, and the mechanism of action of each component is refined. Ultimately, we believe that the mechanism of PG in the treatment of DED is that ginsenosides (GS) intervenes in phenylalanine tryptophan and tyrosine metabolism, stimulates dopamine production, inhibits Aβ deposition and neuroinflammation; and that ginseng polysaccharides (GP) provides energy to strengthen the TCA cycle and improve immune capacity.