Black slaves could not testify in court. The reason was that because of their dependent status as slaves, many of them learned to lie to their master as a way of manipulating him. So it was thought that the testimony of someone whose station in life gave him incentive to lie, would not be reliable in court. Southern white people were afraid of the example of freedom that a free black presented to slaves, so they passed laws making freedom for blacks in the South not so much better than slavery; this would explain why free blacks could not testify in the South. (I am assuming that they could not; I think that they could not; you better look it up.) In the North, there were no slaves and not a lot of free blacks, but the northern states would not let blacks testify in court. The only explanation that I can think of for this is racism.
There are two prefaces to the book. The answer to this question can be found in the one written by William Lloyd Garrison.
He does not specifically say if blacks could ever testify in court. For example, he does not say if blacks could testify against other blacks in a court of law. And he does not say if a black person could testify if, for example, one white man was suing another.
What he does say is that no master could be convicted of cruelty based on black testimony because black people were not allowed to testify against white people.
As to why not, it's because they're not really seen as people.