The present invention provides a pharmaceutical composition comprising bean paste fermented by inoculating licheniformis to boiled beans or an extract thereof as an active ingredient for preventing and treating dementia. The fermented bean paste according to the present invention prevents accumulation of β-amyloid in the hippocampal CA1 region and has effects of alleviating cognitive impairments of a dementia animal model and anti-dementia effect, thereby can be usefully used as a composition for preventing and treating dementia.본 발명은 삶은 콩에 B. licheniformis를 접종하여 발효시킨 청국장 또는 그의 추출물을 유효성분으로 함유하는 치매의 예방 및 치료용 약학 조성물을 제공한다.