I am not familiar with clingo, my understanding of your code is that it generates random numbers, allowing a same number to appear more than once in arbitrary cell positions.
However, the Hitori requires further conditions to be met regarding the allocation of the black cells and the distribution of the white cells.
Depending on the size of the matrix/board, it might take a while for the code to produce, by coincidence, a feasible matrix that also meets the requirements specified in your Hitori solver.
In order to increase our chances, we need to include these additional conditions in the creation process of the matrix.
One way to do it would be:
1. Define an arbitrary number of black cells in the matrix while ensuring no neighboring blacks cells by row or column, and ensuring all white cells to form one connected area
2. Fill in the numbers for the white cells, while ensuring they are all different by row and column
3. Fill in the numbers for the black cells, while ensuring they are the same as one number from the white cells in the same row or in the same column, and ensure all black cells’ number in the same row or in the same column are different
Most of these requirements are resembled in your solver code already, so there is a good chance to re-use and modify code snippets from it.