In vaccine studies, there may be evidence of differential effects depending on individual characteristics, such as age or sex. Traditionally, effect modification has been examined with subgroup analyses. However, in many settings, effect modification is more complex and could, for example, also depend on the infecting pathogen’s characteristics. Sieve analysis examines whether such effects are present by combining pathogen genetic sequence information with individual-level data and can generate new hypotheses on the pathways whereby vaccines provide protection. In this paper, we develop a causal inference framework to evaluate effect modification through sieve analysis. Our approach assesses the magnitude of sieve effects and, in particular, whether these effects are modified by individual-level characteristics. Our method accounts for difficulties occurring in real-world data analysis, such as competing risks, non-randomized treatments, and differential dropout. Our approach also integrates modern machine learning techniques. We demonstrate the validity and efficiency of our approach in simulation studies and in an analysis of a recent malaria vaccine efficacy trial.