The aryl hydrocarbon receptor (AHR) is a ligand-activated transcription factor that regulates the expression of a diverse group of genes. Exogenous AHR ligands include the environmental contaminant 2,3,7,8-tetrachlorodibenzo-p-dioxin (TCDD), which is a potent agonist, and the synthetic AHR antagonist N-2-(1H-indol-3yl)ethyl)-9-isopropyl-2- (5-methylpyridin-3-yl)-9H-purin-6-amine (GNF351). As no experimentally determined structure of the ligand binding domain exists, homology models have been utilized for virtual ligand screening (VLS) to search for novel ligands. Here, we have developed an "agonist-optimized" homology model of the human AHR ligand binding domain, and this model aided in the discovery of two human AHR agonists by VLS. In addition, we performed molecular dynamics simulations of an agonist TCDD-bound and antagonist GNF351-bound version of this model in order to gain insights into the mechanics of the AHR ligand-binding pocket. These simulations identified residues 307-329 as a flexible segment of the AHR ligand pocket that adopts discrete conformations upon agonist or antagonist binding. This flexible segment of the AHR may act as a structural switch that determines the agonist or antagonist activity of a given AHR ligand.