How to choose input variables for ML
[edited, I misread the question in the first version]

The fact that the label is determined from a combination of values from this feature is not a problem in itself: if it makes sense, it's always better to give the best indicators to the learning algorithm. So the only questions are:


whether it makes sense for your problem to have the feature provided as input for any new instance: if yes, then there's no reason to remove it.
whether it's useful to apply ML to your problem: if the label can be determined directly from a single feature, it's simply not useful to train a model.


You mention that the label is based on information from the previous/next two records. Keep in mind that the model needs to predict its target for any individual instance as input, unless you're using a sequential model (for instance with times series).