In hypothesis testing, a sample is taken from a population and compared to a hypothesized value. The sampling distribution is used to determine the probability of obtaining a sample mean that is equal to or more extreme than the hypothesized value. This helps determine whether the hypothesized value is a good estimate of the population mean.