This paper proposes a task allocation optimization for neighboring communications on a fat tree. The proposed method finds an appropriate task allocation that reduces contentions to achieve better communication performance. Since neighboring communications assume that the logical topology of tasks is a mesh or torus, optimization of the task allocation on a tree-based physical topology is not straightforward. This paper describes the proposed task allocation optimization method, which considers the contentions on links for each given allocation to determine the bottleneck link. Then, this method finds the allocation that achieves as wide a bandwidth as possible at the bottleneck link. For comparison, three other allocation methods, TAHB, random, and default, are also examined. The experimental results show that the method proposed by the authors can achieve the same or better performance than can the three abovementioned methods. For example, task allocation with our method was a maximum of 45% faster than that with the TAHB method. The advantage of our method over the TAHB method depends on the number of uplinks on each leaf switch. Unlike TAHB, our method can appropriately consider multiple links.