An efficient channel assignment plays an important role in mitigating co-channel interference in ultra-dense wireless networks. A simple solution is to separate interfering network nodes into orthogonal channels to reduce the interference among them. However, determining the optimal channel assignment is considered to be a non-linear problem, which may also be associated with practical implementation issues such as high computational complexity and control signaling issues. In an effort to cope with these challenging issues, we propose a distributed channel assignment algorithm that efficiently finds the optimal channel configuration by utilizing the concept of belief propagation. Based on a message-passing framework, the proposed distributed channel assignment algorithm maximizes the overall sum rate of the ultra-dense network with a low computational load for each network node. In addition, we design a network protocol and frame format to implement the proposed message-passing framework to real-world wireless networks. The main advantage of the proposed approach is that network nodes autonomously determine the optimal channel assignment and rapidly adapt to dynamic changes of the network. Simulation results confirm that the proposed distributed channel assignment algorithm outperforms conventional algorithms in terms of various network performance aspects, such as the sum rate, scalability, latency, and user mobility.