This article reports on the computational design, development and application of a molecularly imprinted polymer (MIP) with specific affinity towards histamine. Computational modelling was used to screen a monomer library in order to select the monomers able to form the strongest complex with the target analyte. These were subsequently used for MIP synthesis by radical polymerisation initiated by UV. MIPs were then evaluated by liquid chromatography and solid phase extraction (SPE) and best MIP behaviour was observed when itaconic acid was used as functional monomer. Finally, after optimisation of the polymer composition, MIPs were used as adsorbents for SPE and clean-up of histamine in wine samples. The proposed histamine extraction method with the MIP-SPE cartridge was found to be reproducible (<5% RSD) and accurate (93-99% recovery) and provided clear wine extracts. The described methodology is simple and fast and is suitable for the selective histamine extraction and its subsequent quantification by HPLC-DAD from complex matrices such as wine samples.