We reveal thermodynamic structure in population dynamics with phenotype switching. Mean fitness for a population of organisms is determined by a thermodynamic variational principle described by the large deviation of phenotype-switching dynamics. Owing to this variational principle, a response relation of the mean fitness with respect to changes of environments and phenotype-switching dynamics is represented as a thermodynamic differential form. Furthermore, we discuss the strength of the selection by using the difference between time-forward and time-backward (retrospective) processes.