To process the complex link state signals and obtain the accurate failure decision criterion in the deployment of two-dimensional optical coding link health detection system to an actual PON system with massive densely distributed customers, we develop a customer distribution model which divide interference customers into two categories: sparse and dense distribution, and propose a code allocation rule by changing the connection between the output ports of encoder and access customers. Simulation results show that in 128-customer system with 2km 2 coverage, customer interference probability is reduced by 0.129. The customer distribution model and the code allocation rule are demonstrated by experiment, and the results show that customer interference is significantly mitigated by using code allocation. INDEX TERMS Passive optical network (PON), link health detection system (LHDS), two-dimensional (2D) optical coding, customer interference.