This paper introduces an approach to solve the task assignment problem for a large number of tasks and robots in an efficient time. This method reduces the size of the state space explored by partitioning the tasks to the number of robotic agents. The proposed method is divided into three stages: first the tasks are partitioned to the number of robots, then robots are being assigned to the clusters optimally, and finally a task assignment algorithm is executed individually at each cluster. Two methods are adopted to solve the task assignment at each cluster, a genetic algorithm and an imitation learning algorithm. To verify the performance of the proposed approach, several numerical simulations are performed. Our empirical evaluation shows that clustering leads to great savings in runtime (up to a factor of 50), while maintaining the quality of the solution.