Summary Smart completions enable physical measurements over space and time, which provides large volumes of information at unprecedented rates. However, optimizing inflow control valve (ICV) settings of smart multilateral wells is a challenging task. Traditionally, ICV field tests, evaluating well performance at different ICV settings, are conducted to observe flow behavior and configure ICVs; however, this is often suboptimal. This study investigated a surrogate-based optimization algorithm that minimizes the number of ICV field tests required, predicts well performance of all unseen combination of ICV settings, and determines the optimal ICV setting and net present value (NPV). A numerical model of a real offshore field in Saudi Arabia was used to generate scenarios involving a two-phase (oil and water) reservoir with trilateral producers. Multiple scenarios were examined with variations in design parameters, mainly well count, placement, and configuration. Eight discrete settings were assumed to match the commonly installed ICV technology, where all possible scenarios were simulated to establish ground truth. The investigation considered three major algorithmic components: sampling, machine learning, and optimization. The sampling strategy compared physics-based initialization, space-filling sampling, and triangulation-based adaptive sampling. A cross-validated neural network was used to fit a surrogate (in this case, machine learning algorithm) dynamically, whereas enumeration was adopted for optimization to avoid errors arising from using common optimizers. This study evaluated two sampling techniques: space-filling and adaptive sampling. The latter was found superior in capturing reservoir behavior with the smallest number of simulation runs (i.e., ICV field tests). Algorithm performance was evaluated based on the number of ICV field tests required to exceed an R2 threshold of 90% on all unseen scenarios and match the optimal ICV settings and NPV. Surface and downhole flow profile prediction and optimization were achieved successfully using this approach. To determine the diminishing value of additional ICV field tests, the triangulation sampling loss was used as a stoppage criterion. When running the algorithm on a single producer for both surface and downhole oil and water flow prediction, the algorithm required only 6 and 11 ICV field tests to achieve 80% and 90% R2 across the different cases of this real reservoir model. Fishbone wellbore configurations were found to pose a more challenging task because changes in any ICV pressure decrease affects multiple laterals simultaneously, which increases the level of interdependence. The resultant surrogate was used to decide on the optimal settings of ICV devices and effectively predict the NPV. Surrogates, in this approach, are statistical proxies of the targeted ground-truth production function. Further improvement was accomplished through adaptively sampling and fitting surrogates to predict NPV explicitly, where NPV predictions were generated with nearly 95% R2 given only 10 ICV field tests. Using adaptive sampling and machine learning proved effective in the prediction of surface and downhole flow profiles and optimization of smart wells. The method further allows for dynamically optimizing field strategy in a reinforcement learning setting where production data are used continuously to further improve the prediction performance.