Membrane distillation (MD) has the potential to expand its application from desalination to wastewater treatment by developing a in-situ membrane fouling and wetting detection system. In this study, advanced in-situ 3D optical coherence tomography (OCT), coupled with model simulation, was used to reveal the fouling mechanisms in real-time during MD treatment of industrial textile wastewater. Additionally, an ultrasonic cleaning operation was conducted to control fouling and regenerate the fouled membrane. Two commercial membranes, polyvinylidene fluoride (C-PVDF) and polytetrafluoroethylene (C-PTFE), were applied in dye wastewater treatment by MD, where the C-PTFE membrane achieved 99.9% dye removal. 3D-OCT images indicated that the foulant attachment on the C-PTFE membrane was much looser than on the C-PVDF membrane, owing to its pattern shaped surface morphology and higher hydrophobicity as explained through mathematic modeling. Average water flux was maintained above 31.38 ± 0.19 LMH for 24 h MD operation with the C-PTFE membrane and a water recovery rate of 73.2 ± 0.26% was attained by using the in-line ultrasonic operation.