Anorectal manometry is a diagnostic test used to evaluate the function of the muscles in the rectum and anus. It measures the pressure exerted by the anal sphincter muscles, rectal sensation, and neural reflexes that are essential for normal bowel movements. This test is crucial in diagnosing conditions like fecal incontinence and chronic constipation.