Do you have empty id values? In that case, your query would be "ID = ", which is an invalid query.
var id = $feature.ID
if(id == null) { return false } // feature is invalid if no id
var tbl = FeaturesetbyName($datastore, "IDs", ["ID"], false);
var query = "ID = @ID"; // try using this notation instead
var countID = Count(Filter(tbl, query));
return countID == 1 // valid if exactly 1 feature has this ID, else invalid
Have a great day!
Johannes