Linkage effects in a multi-locus population strongly influence its evolution. Recent models based on the traveling wave approach enable us to predict the speed of evolution and the statistics of phylogeny. However, predicting the evolution of specific sites and pairs of sites in the multi-locus context remains a mathematical challenge. In particular, the effect of epistasis, the interaction of gene regions contributing to phenotype, is difficult both to predict theoretically and detect experimentally in sequence data. A large number of false interactions arising from linkage and indirect interactions which mask true interactions. Here we develop a method to clean false-positive interactions. We start by demonstrating that averaging of the two-way haplotype frequencies over a hundred of independent populations is not enough to clear false interactions. Then, to address this problem, we develop analytically and use a triple-way haplotype test, which isolates true interactions. Next, the fidelity of the test is confirmed on simulated genetic sequences, where the epistatic network known in advance. Finally, we apply the test to a large database on influenza A H1N1 virus sequences of neurominidase from various geographic locations to predict the epistatic network responsible for the transition from the pre-pandemic virus to the pandemic strain. We predict a primary mutation and 15-22 secondary compensatory mutations of variable strength, as many as typically observed for drug resistance and immune escape mutations in HIV. These results present a simple and reliable method to measure epistatic interaction from sequence data.Author’s summaryInteraction of genomic sites creating “fitness landscape” is very important for predicting the escape of viruses from drugs and immune response and for pssinf through fitness valleys. Many efforts have been invested into measuring these interactions from DNA sequence sets. Unfortunately, reproducibility of the results remains low, due partly to a very small fraction of interaction pairs, and partly to stochastic noise intrinsic for evolution masking true interactions. Here we propose a method based on analysis of genetic sequences at three genomic sites to clean stochastic linkage and apply it to influenza virus sequence data.