β‐carboline alkaloids have a variety of pharmacological activities, such as anti‐tumor, antibiosis and anti‐diabetes. Harmine and harmol are two structurally similar β‐carbolines that occur in many medicinal plants. In this work, we chose harmine and harmol to impede the amyloid fibril formation of human islet amyloid polypeptide (hIAPP) associated with type 2 diabetes mellitus (T2DM), by a series of physicochemical and biochemical methods. The results indicate that harmine and harmol effectively prevent peptide fibrillation and alleviate toxic oligomer species. In addition, both small molecules exhibit strong binding affinities with hIAPP mainly through hydrophobic and hydrogen bonding interactions, reducing the cytotoxicity induced by hIAPP. Their distinct binding pattern with hIAPP is closely linked to the molecular configuration of two small molecules, affecting their ability to impede peptide aggregation. The study is of great significance for the application and development of β‐carboline alkaloids against T2DM.