A central goal of community ecology is to infer biotic interactions from observed distributions of co-occurring species. Evidence for biotic interactions, however, can be obscured by shared environmental requirements, posing a challenge for statistical inference. Here, we introduce a dynamic statistical model, based on probit regression, that quantifies the effects of spatial and temporal covariance in longitudinal co-occurrence data. We separate the fixed pairwise effects of species occurrences on persistence and colonization rates, a potential signal of direct interactions, from latent pairwise correlations in occurrence, a potential signal of shared environmental responses. We first validate our modeling framework with several simulation studies. Then, we apply the approach to a pressing epidemiological question by examining how human papillomavirus (HPV) types coexist. Our results suggest that while HPV types respond similarly to common host traits, direct interactions are sparse and weak, so that HPV type diversity depends largely on shared environmental drivers. Our modeling approach is widely applicable to microbial communities and provides valuable insights that should lead to more directed hypothesis testing and mechanistic modeling.