We consider the following problem: a principal has a good to allocate among a collection of agents who attach a private value to receiving the good. The principal, instead of using monetary transfers (i.e. charging the agents) to allocate the good, can check the truthfulness of the agents' value declaration at a cost. Under the assumption that the agents' valuations are drawn from a discrete set of values at random, we characterize the class of optimal Bayesian mechanisms which are symmetric, direct and maximizing the expected value of assigning the good to the principal minus the cost of verification using such standard finite-dimensional optimization tools as linear programming and submodular functions, thus extending the work of [R.V. Vohra, Optimization and mechanism design, Math. Program. 134 (2012), pp. 283-303]. Our results are discrete-type analogs of those of [E. Ben-Porath, E. Dekel, and B.L. LipmanBen-Porath, Optimal allocation with costly verification, Amer. Econ. Rev. 104 (2014), pp. 3779-3813]. When the distribution of valuations is not known but can be one of a set of distributions (the case referred to as ambiguity), we compute a robust allocation mechanism by maximizing the worst-case expected value of the principal in two cases amenable to solution with two suitable assumptions on the set of distributions.