Here’s the Wikipedia article:
https://en.wikipedia.org/wiki/Dakota_War_of_1862
The section labeled “War” contains the account of the “trials” and Lincoln’s careful review of each case to winnow out the true murderers from those who merely participated in the battles. The Dakota 38 were not some haphazardly chosen group.
BTW the state of Minnesota has apologized for the mistreatment of the Native Americans. Have the Native Americans reciprocated? Hundreds of settlers were either killed outright (men) or taken captive (women and children). Thirty eight vs. hundreds. Seems like some ex post facto recognition of the wrongs done needs to be extended to the settlers even if it is very late in coming.
Those settlers were farming the land and raising their families. Unpardonable!/s